本文整理汇总了PHP中group_memberships函数的典型用法代码示例。如果您正苦于以下问题:PHP group_memberships函数的具体用法?PHP group_memberships怎么用?PHP group_memberships使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了group_memberships函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_user_add_quota
/**
* Return user vehicle quota
*/
function get_user_add_quota()
{
global $db, $user, $garage_config, $garage, $phpEx, $phpbb_root_path;
if (empty($garage_config['add_groups'])) {
//Since No Specific Group Value Exists Use Default Value
return $garage_config['default_vehicle_quota'];
} else {
//Get All Group Memberships
include_once $phpbb_root_path . 'includes/functions_user.' . $phpEx;
$groups = group_memberships(false, array($user->data['user_id']), false);
//Lets Get The Private Upload Groups & Quotas
$private_add_groups = @explode(',', $garage_config['add_groups']);
$private_add_quotas = @explode(',', $garage_config['add_groups_quotas']);
//Process All Groups You Are Member Of To See If Any Are Granted Permission & Quota
for ($i = 0; $i < count($groups); $i++) {
if (in_array($groups[$i]['group_id'], $private_add_groups)) {
//Your A Member Of A Group Granted Permission - Find Array Key
$index = array_search($groups[$i]['group_id'], $private_add_groups);
//So Your Quota For This Group Is...
$quota[$i] = $private_add_quotas[$index];
}
}
//Your Were Not Granted Any Private Permissions..Return Default Value
if (empty($quota)) {
return $garage_config['default_vehicle_quota'];
}
//Return The Highest Quota You Were Granted
return max($quota);
}
}
示例2: _fetch_users
/**
* Grep the users that aren't in the groups
* @param Boolean $missing If true this function will return whether there are users
* missing
*/
function _fetch_users($missing = false)
{
global $db;
if (!function_exists('group_memberships')) {
require PHPBB_ROOT_PATH . 'includes/functions_user.' . PHP_EXT;
}
// Get teh group IDs
$g = $this->_get_group_ids();
// Now figure out whether there are users that aren't part in any of these
$batch = $users = array();
$data = group_memberships($g);
if (!empty($data)) {
foreach ($data as $user) {
$users[] = (int) $user['user_id'];
}
$sql = 'SELECT user_id
FROM ' . USERS_TABLE . '
WHERE ' . $db->sql_in_set('user_id', $users, true) . '
AND user_type <> ' . USER_IGNORE;
$result = $missing ? $db->sql_query_limit($sql, 1, 0) : $db->sql_query($sql);
$batch = $db->sql_fetchrowset($result);
$db->sql_freeresult($result);
}
// Return the correct stuff
if ($missing) {
return empty($batch) ? false : true;
}
return $batch;
}
示例3: isGroup
function isGroup($userid)
{
$groups = group_memberships(false, $userid);
$return = false;
foreach ($groups as $grouprec) {
if ($grouprec['group_id'] == 22 || $grouprec['group_id'] == 9 || $grouprec['group_id'] == 11 || $grouprec['group_id'] == 12 || $grouprec['group_id'] == 10 || $grouprec['group_id'] == 4) {
$return = true;
}
}
return $return;
}
示例4: get_role
private function get_role($localuser)
{
$role = $this->config['phpbbwpunicorn_wp_default_role'];
//TODO: this actually shows a bad design, requiring me to loop over roles whereas a bi-directionnal array could have mesaved from that
//stock every role into a single multi dim array?
$potential_roles[] = $role ? $role : [];
$roles = new \WP_Roles();
foreach (array_reverse(array_keys($roles->roles)) as $wp_role) {
$phpbb_roles = unserialize($this->config['phpbbwpunicorn_role_' . $wp_role]);
foreach ($phpbb_roles as $phpbb_role) {
$user_groups = group_memberships(false, $localuser['user_id']);
foreach ($user_groups as $user_group) {
if ($phpbb_role == $user_group["group_id"]) {
$potential_roles[] = $wp_role;
}
}
}
}
//pooooooooooor design, gush.
//Which one are we supposed to return? Lol. first of order per ID Desc?
return $potential_roles[count($potential_roles) - 1];
}
示例5: display_mask
/**
* Display permission mask (assign to template)
*/
function display_mask($mode, $permission_type, &$hold_ary, $user_mode = 'user', $local = false, $group_display = true)
{
global $template, $user, $db, $phpbb_root_path, $phpEx;
// Define names for template loops, might be able to be set
$tpl_pmask = 'p_mask';
$tpl_fmask = 'f_mask';
$tpl_category = 'category';
$tpl_mask = 'mask';
$l_acl_type = isset($user->lang['ACL_TYPE_' . ($local ? 'LOCAL' : 'GLOBAL') . '_' . strtoupper($permission_type)]) ? $user->lang['ACL_TYPE_' . ($local ? 'LOCAL' : 'GLOBAL') . '_' . strtoupper($permission_type)] : 'ACL_TYPE_' . ($local ? 'LOCAL' : 'GLOBAL') . '_' . strtoupper($permission_type);
// Allow trace for viewing permissions and in user mode
$show_trace = $mode == 'view' && $user_mode == 'user' ? true : false;
// Get names
if ($user_mode == 'user') {
$sql = 'SELECT user_id as ug_id, username as ug_name
FROM ' . USERS_TABLE . '
WHERE user_id IN (' . implode(', ', array_keys($hold_ary)) . ')
ORDER BY username ASC';
} else {
$sql = 'SELECT group_id as ug_id, group_name as ug_name, group_type
FROM ' . GROUPS_TABLE . '
WHERE group_id IN (' . implode(', ', array_keys($hold_ary)) . ')
ORDER BY group_type DESC, group_name ASC';
}
$result = $db->sql_query($sql);
$ug_names_ary = array();
while ($row = $db->sql_fetchrow($result)) {
$ug_names_ary[$row['ug_id']] = $user_mode == 'user' ? $row['ug_name'] : ($row['group_type'] == GROUP_SPECIAL ? $user->lang['G_' . $row['ug_name']] : $row['ug_name']);
}
$db->sql_freeresult($result);
// Get used forums
$forum_ids = array();
foreach ($hold_ary as $ug_id => $row) {
$forum_ids = array_merge($forum_ids, array_keys($row));
}
$forum_ids = array_unique($forum_ids);
$forum_names_ary = array();
if ($local) {
$forum_names_ary = make_forum_select(false, false, true, false, false, true);
} else {
$forum_names_ary[0] = $l_acl_type;
}
// Get available roles
$sql = 'SELECT *
FROM ' . ACL_ROLES_TABLE . "\n\t\t\tWHERE role_type = '" . $db->sql_escape($permission_type) . "'\n\t\t\tORDER BY role_order ASC";
$result = $db->sql_query($sql);
$roles = array();
while ($row = $db->sql_fetchrow($result)) {
$roles[$row['role_id']] = $row;
}
$db->sql_freeresult($result);
$cur_roles = $this->acl_role_data($user_mode, $permission_type, array_keys($hold_ary));
// Build js roles array (role data assignments)
$s_role_js_array = '';
if (sizeof($roles)) {
$s_role_js_array = array();
// Make sure every role (even if empty) has its array defined
foreach ($roles as $_role_id => $null) {
$s_role_js_array[$_role_id] = "\n" . 'role_options[' . $_role_id . '] = new Array();' . "\n";
}
$sql = 'SELECT r.role_id, o.auth_option, r.auth_setting
FROM ' . ACL_ROLES_DATA_TABLE . ' r, ' . ACL_OPTIONS_TABLE . ' o
WHERE o.auth_option_id = r.auth_option_id
AND r.role_id IN (' . implode(', ', array_keys($roles)) . ')';
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result)) {
$flag = substr($row['auth_option'], 0, strpos($row['auth_option'], '_') + 1);
if ($flag == $row['auth_option']) {
continue;
}
$s_role_js_array[$row['role_id']] .= 'role_options[' . $row['role_id'] . '][\'' . $row['auth_option'] . '\'] = ' . $row['auth_setting'] . '; ';
}
$db->sql_freeresult($result);
$s_role_js_array = implode('', $s_role_js_array);
}
$template->assign_var('S_ROLE_JS_ARRAY', $s_role_js_array);
// Now obtain memberships
$user_groups_default = $user_groups_custom = array();
if ($user_mode == 'user' && $group_display) {
$sql = 'SELECT group_id, group_name, group_type
FROM ' . GROUPS_TABLE . '
ORDER BY group_type DESC, group_name ASC';
$result = $db->sql_query($sql);
$groups = array();
while ($row = $db->sql_fetchrow($result)) {
$groups[$row['group_id']] = $row;
}
$db->sql_freeresult($result);
$memberships = group_memberships(false, array_keys($hold_ary), false);
// User is not a member of any group? Bad admin, bad bad admin...
if ($memberships) {
foreach ($memberships as $row) {
if ($groups[$row['group_id']]['group_type'] == GROUP_SPECIAL) {
$user_groups_default[$row['user_id']][] = $user->lang['G_' . $groups[$row['group_id']]['group_name']];
} else {
$user_groups_custom[$row['user_id']][] = $groups[$row['group_id']]['group_name'];
}
}
//.........这里部分代码省略.........
示例6: process_block_modules
//.........这里部分代码省略.........
$active_blocks[] = $row;
$arr[$row['id']] = explode(',', $row['view_pages']);
}
$this_page_name = $this->get_current_page();
$id = $request->variable('style', 0);
if ($id) {
if (strstr($this_page_name, 'portal')) {
$page_id = get_page_id('portal');
} else {
if (strstr($this_page_name, 'index')) {
$page_id = get_page_id('index');
} else {
$page_id = get_page_id($this_page_name);
}
}
} else {
$page_id = get_page_id($this_page_name);
}
//var_dump('RETURNED: ' . $this_page_name . ' ID: ' . $page_id);
if ($page_id == 0) {
$page_id = $this_page[0];
$page_id = get_page_id($this_page[0]);
}
foreach ($active_blocks as $active_block) {
$filename = substr($active_block['html_file_name'], 0, strpos($active_block['html_file_name'], '.'));
if (file_exists($phpbb_root_path . 'ext/phpbbireland/portal/blocks/' . $filename . '.' . $this->php_ext)) {
if (in_array($page_id, $arr[$active_block['id']])) {
//var_dump('process_block_modules > foreach returned' . $filename);
include $phpbb_root_path . 'ext/phpbbireland/portal/blocks/' . $filename . '.' . $this->php_ext;
}
}
}
$db->sql_freeresult($result);
if (!function_exists('group_memberships')) {
include $phpbb_root_path . 'includes/functions_user.' . $this->php_ext;
}
$memberships = array();
$memberships = group_memberships(false, $user->data['user_id'], false);
// Main processing of block data here //
if ($active_blocks) {
$L = $R = $C = 0;
foreach ($active_blocks as $row) {
$block_position = $row['position'];
// override default position with user designated position //
if (in_array($row['id'], $LB)) {
$block_position = 'L';
} else {
if (in_array($row['id'], $CB)) {
$block_position = 'C';
} else {
if (in_array($row['id'], $RB)) {
$block_position = 'R';
}
}
}
$block_id = $row['id'];
$block_ndx = $row['ndx'];
$block_title = $row['title'];
$block_active = $row['active'];
$block_type = $row['type'];
$block_view_groups = $row['view_groups'];
$block_view_all = $row['view_all'];
$block_scroll = $row['scroll'];
$block_height = $row['block_height'];
$html_file_name = $row['html_file_name'];
$img_file_name = $row['img_file_name'];
示例7: _anon_groups
function _anon_groups(&$_in_guests, &$_other_groups)
{
global $db;
// Fetch the groups our user is in
if (!function_exists('group_memberships')) {
include PHPBB_ROOT_PATH . 'includes/functions_user.' . PHP_EXT;
}
$groups = group_memberships(false, ANONYMOUS);
if (empty($groups)) {
$groups = array();
}
// Get the group id of GUESTS
$sql = 'SELECT group_id
FROM ' . GROUPS_TABLE . "\n\t\t\tWHERE group_name = 'GUESTS'";
$result = $db->sql_query_limit($sql, 1, 0);
$gid = $db->sql_fetchfield('group_id', false, $result);
$db->sql_freeresult($result);
// Build the information
foreach ($groups as $group => $group_data) {
if ($group_data['group_id'] == $gid) {
$_in_guests = $group_data['group_id'];
continue;
}
$_other_groups[] = $group_data['group_id'];
}
if ($_in_guests === false) {
return $gid;
}
}
示例8: display_mask
//.........这里部分代码省略.........
// Make sure every role (even if empty) has its array defined
foreach ($roles as $_role_id => $null) {
$s_role_js_array[$_role_id] = "\n" . 'role_options[' . $_role_id . '] = new Array();' . "\n";
}
$sql = 'SELECT r.role_id, o.auth_option, r.auth_setting
FROM ' . ACL_ROLES_DATA_TABLE . ' r, ' . ACL_OPTIONS_TABLE . ' o
WHERE o.auth_option_id = r.auth_option_id
AND ' . $db->sql_in_set('r.role_id', array_keys($roles));
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result)) {
$flag = substr($row['auth_option'], 0, strpos($row['auth_option'], '_') + 1);
if ($flag == $row['auth_option']) {
continue;
}
$s_role_js_array[$row['role_id']] .= 'role_options[' . $row['role_id'] . '][\'' . addslashes($row['auth_option']) . '\'] = ' . $row['auth_setting'] . '; ';
}
$db->sql_freeresult($result);
$s_role_js_array = implode('', $s_role_js_array);
}
$template->assign_var('S_ROLE_JS_ARRAY', $s_role_js_array);
unset($s_role_js_array);
// Now obtain memberships
$user_groups_default = $user_groups_custom = array();
if ($user_mode == 'user' && $group_display) {
$sql = 'SELECT group_id, group_name, group_type
FROM ' . GROUPS_TABLE . '
ORDER BY group_type DESC, group_name ASC';
$result = $db->sql_query($sql);
$groups = array();
while ($row = $db->sql_fetchrow($result)) {
$groups[$row['group_id']] = $row;
}
$db->sql_freeresult($result);
$memberships = group_memberships(false, array_keys($hold_ary), false);
// User is not a member of any group? Bad admin, bad bad admin...
if ($memberships) {
foreach ($memberships as $row) {
$user_groups_default[$row['user_id']][] = $group_helper->get_name($groups[$row['group_id']]['group_name']);
}
}
unset($memberships, $groups);
}
// If we only have one forum id to display or being in local mode and more than one user/group to display,
// we switch the complete interface to group by user/usergroup instead of grouping by forum
// To achieve this, we need to switch the array a bit
if (sizeof($forum_ids) == 1 || $local && sizeof($ug_names_ary) > 1) {
$hold_ary_temp = $hold_ary;
$hold_ary = array();
foreach ($hold_ary_temp as $ug_id => $row) {
foreach ($forum_names_ary as $forum_id => $forum_row) {
if (isset($row[$forum_id])) {
$hold_ary[$forum_id][$ug_id] = $row[$forum_id];
}
}
}
unset($hold_ary_temp);
foreach ($hold_ary as $forum_id => $forum_array) {
$content_array = $categories = array();
$this->build_permission_array($hold_ary[$forum_id], $content_array, $categories, array_keys($ug_names_ary));
$template->assign_block_vars($tpl_pmask, array('NAME' => $forum_id == 0 ? $forum_names_ary[0] : $forum_names_ary[$forum_id]['forum_name'], 'PADDING' => $forum_id == 0 ? '' : $forum_names_ary[$forum_id]['padding'], 'CATEGORIES' => implode('</th><th>', $categories), 'L_ACL_TYPE' => $l_acl_type, 'S_LOCAL' => $local ? true : false, 'S_GLOBAL' => !$local ? true : false, 'S_NUM_CATS' => sizeof($categories), 'S_VIEW' => $mode == 'view' ? true : false, 'S_NUM_OBJECTS' => sizeof($content_array), 'S_USER_MODE' => $user_mode == 'user' ? true : false, 'S_GROUP_MODE' => $user_mode == 'group' ? true : false));
@reset($content_array);
while (list($ug_id, $ug_array) = each($content_array)) {
// Build role dropdown options
$current_role_id = isset($cur_roles[$ug_id][$forum_id]) ? $cur_roles[$ug_id][$forum_id] : 0;
// Output current role id to template
$template->assign_var('S_ROLE_ID', $current_role_id);
示例9: group_memberships
$phpEx = 'php';
include $phpbb_root_path . 'common.' . $phpEx;
include $phpbb_root_path . 'includes/functions_display.' . $phpEx;
include $phpbb_root_path . 'includes/functions_user.' . $phpEx;
include $phpbb_root_path . 'config.' . $phpEx;
$user->session_begin();
$auth->acl($user->data);
$user->setup();
$user->get_profile_fields($user->data['user_id']);
//------------- Global Information of User -------------//
// Get Users Name
$userName = $user->data['username'];
$userNameClean = $user->data['username_clean'];
$userID = $user->data['user_id'];
// Get Users Groups
$userGroups = group_memberships(false, $user->data['user_id']);
$userGroupCou = count($userGroups);
$userGroupIDs = array();
for ($x = 0; $x < $userGroupCou; $x++) {
array_push($userGroupIDs, $userGroups[$x]['group_id']);
}
// Get Users Class
$userMainClass = $user->profile_fields['pf_main_class'];
$userAlt1Class = $user->profile_fields['pf_alt_one_class'];
$userAlt2Class = $user->profile_fields['pf_alt_two_class'];
$userAlt3Class = $user->profile_fields['pf_alt_three_class'];
// Get Users Colour
$userColour = $user->data['colour'];
// Get Users Timezone
$userTimeZone = $_SESSION['userTimeZone'];
// Set Users Character Array
示例10: in_watch_group
/**
* Is user in a specified watch group
*
* @param int $user_id User identifier
* @return bool True if in group, false otherwise
* @access protected
*/
protected function in_watch_group($user_id)
{
$group_id_ary = !$this->config['sec_usergroups'] ? array() : json_decode(trim($this->config['sec_usergroups']), true);
if (empty($group_id_ary)) {
return false;
}
if (!function_exists('group_memberships')) {
include $this->phpbb_root_path . 'includes/functions_user.' . $this->php_ext;
}
return group_memberships($group_id_ary, $user_id, true);
}
示例11: main
function main($id, $mode)
{
global $db, $user, $auth, $template, $config, $phpbb_root_path, $phpEx;
$Navigation = new \bbdkp\views\viewNavigation('ucp');
$user->add_lang(array('mods/raidplanner', 'mods/dkp_common'));
if (!function_exists('group_memberships')) {
include_once $phpbb_root_path . 'includes/functions_user.' . $phpEx;
}
$this->eventlist = new \bbdkp\controller\raidplanner\rpevents($Navigation->getDkpsysId());
// get the groups of which this user is part of.
$groups = group_memberships(false, $user->data['user_id']);
$group_options = "";
// build the sql to get access
foreach ($groups as $grouprec) {
if ($group_options != "") {
$group_options .= " OR ";
}
$group_options .= "group_id = " . $grouprec['group_id'] . " OR group_id_list LIKE '%," . $grouprec['group_id'] . ",%'";
}
// build template
$daycount = request_var('daycount', 7);
$disp_date_format = $config['rp_date_format'];
$disp_date_time_format = $config['rp_date_time_format'];
// show all in coming year
$start_temp_date = time() - 86400;
$sort_timestamp_cutoff = $start_temp_date + 86400 * 365;
// get
$sql_array = array('SELECT' => ' r.raidplan_id ', 'FROM' => array(RP_RAIDS_TABLE => 'r'), 'WHERE' => '
(r.raidplan_access_level = 2)
OR (r.poster_id = ' . $db->sql_escape($user->data['user_id']) . ' )
OR (r.raidplan_access_level = 1 AND (' . $group_options . ') )
AND r.raidplan_start_time >= ' . (int) $start_temp_date . '
AND r.raidplan_start_time <= ' . (int) $sort_timestamp_cutoff, 'ORDER_BY' => 'r.raidplan_start_time ASC ');
$sql = $db->sql_build_query('SELECT', $sql_array);
$result = $db->sql_query_limit($sql, $config['rp_display_next_raidplans'], 0);
while ($row = $db->sql_fetchrow($result)) {
unset($raidplan);
$raidplan = new Raidplan($Navigation->getGameId(), $Navigation->getGuildId(), $this->eventlist->events, $row['raidplan_id']);
if (!isset($this->eventlist->events[$raidplan->getEventType()])) {
//this event is closed, so fetch the whole eventlist including closed ones.
$this->eventlist = new \bbdkp\controller\raidplanner\rpevents(0);
}
if (strlen($this->eventlist->events[$raidplan->getEventType()]['imagename']) > 1) {
$eventimg = $phpbb_root_path . "images/bbdkp/event_images/" . $this->eventlist->events[$raidplan->getEventType()]['imagename'] . ".png";
} else {
$eventimg = $phpbb_root_path . "images/bbdkp/event_images/dummy.png";
}
$subj = $raidplan->getSubject();
if ($config['rp_display_truncated_name'] > 0) {
if (utf8_strlen($raidplan->getSubject()) > $config['rp_display_truncated_name']) {
$subj = truncate_string(utf8_strlen($raidplan->getSubject()), $config['rp_display_truncated_name']) . '…';
}
}
$delete_url = "";
$edit_url = "";
if ($user->data['is_registered']) {
// can user edit ?
if ($auth->acl_get('u_raidplanner_edit_raidplans') && ($user->data['user_id'] == $raidplan->getPoster() || $auth->acl_get('m_raidplanner_edit_other_users_raidplans'))) {
$edit_url = append_sid("{$phpbb_root_path}dkp.{$phpEx}", "page=planner&view=raidplan&action=showadd&raidplanid=" . $raidplan->id);
}
//can user delete ?
if ($auth->acl_get('u_raidplanner_delete_raidplans') && ($user->data['user_id'] == $raidplan->getPoster() || $auth->acl_get('m_raidplanner_delete_other_users_raidplans'))) {
$delete_url = append_sid("{$phpbb_root_path}dkp.{$phpEx}", "page=planner&view=raidplan&action=delete&raidplanid=" . $raidplan->id);
}
}
$template->assign_block_vars('raids', array('RAID_ID' => $raidplan->id, 'IMAGE' => $eventimg, 'EVENTNAME' => $this->eventlist->events[$raidplan->getEventType()]['event_name'], 'EVENT_URL' => append_sid("{$phpbb_root_path}dkp.{$phpEx}", "page=planner&view=raidplan&raidplanid=" . $raidplan->id), 'EVENT_ID' => $raidplan->id, 'COLOR' => $this->eventlist->events[$raidplan->getEventType()]['color'], 'SUBJECT' => $subj, 'U_DELETE' => $delete_url, 'U_EDIT' => $edit_url, 'POSTER' => $raidplan->getPosterUrl(), 'START_TIME' => $user->format_date($raidplan->getStartTime(), $disp_date_time_format, true), 'START_TIME' => $user->format_date($raidplan->getStartTime(), $config['rp_date_format'], true), 'END_TIME' => $user->format_date($raidplan->getEndTime(), $config['rp_time_format'], true), 'DISPLAY_BOLD' => $user->data['user_id'] == $raidplan->getPoster() ? true : false));
// get signups
foreach ($raidplan->getRaidroles() as $key => $role) {
foreach ($role['role_signups'] as $signup) {
if (is_object($signup) && $signup instanceof RaidplanSignup) {
switch ($signup->getSignupVal()) {
case 0:
$signupcolor = '#00FF00';
$signuptext = $user->lang['YES'];
break;
case 1:
$signupcolor = '#FF0000';
$signuptext = $user->lang['NO'];
break;
case 2:
$signupcolor = '#FFCC33';
$signuptext = $user->lang['MAYBE'];
break;
}
$template->assign_block_vars('raids.signups', array('COLOR' => $signupcolor, 'CHARNAME' => $signup->getDkpmembername(), 'COLORCODE' => $signup->getColorcode() == '' ? '#123456' : $signup->getColorcode(), 'CLASS_IMAGE' => strlen($signup->getImagename()) > 1 ? $phpbb_root_path . "images/bbdkp/class_images/" . $signup->getImagename() . ".png" : '', 'S_CLASS_IMAGE_EXISTS' => strlen($signup->getImagename()) > 1 ? true : false, 'VALUE_TXT' => " : " . $signuptext));
}
}
}
}
$db->sql_freeresult($result);
switch ($mode) {
case 'raidplanner_registration':
$this->tpl_name = 'planner/ucp_planner';
$template->assign_vars(array('U_COUNT_ACTION' => $this->u_action, 'DAYCOUNT' => $daycount));
break;
}
}
示例12: above_image_quotas
/**
* Return boolean if user is above remote or uploaded quota depending on image
*
* @return boolean
*
*/
function above_image_quotas()
{
global $phpbb_root_path, $phpEx, $user;
include_once $phpbb_root_path . 'includes/functions_user.' . $phpEx;
//Get All Users Images So We Can Workout Current Quota Usage
$user_upload_image_data = $this->get_user_upload_images($user->data['user_id']);
$user_remote_image_data = $this->get_user_remote_images($user->data['user_id']);
//Get Users Group Memberships Now As We Should Do This Only Once
$group_memberships = group_memberships(false, array($user->data['user_id']), false);
//You Have Reached Your Image Quota
if ($this->image_is_remote() and sizeof($user_remote_image_data) >= $this->get_user_remote_image_quota($group_memberships) or $this->image_is_local() and sizeof($user_upload_image_data) >= $this->get_user_upload_image_quota($group_memberships)) {
return true;
}
}
示例13: trigger_error
$sql = "SELECT * FROM " . K_MENUS_TABLE . "\n\tWHERE menu_type = " . HEAD_MENUS . "\n\tORDER BY ndx ASC";
if (!($result = $db->sql_query($sql, $block_cache_time))) {
if (!($result = $db->sql_query($sql))) {
trigger_error($user->lang['ERROR_PORTAL_MENUS']);
}
}
$portal_menus = array();
while ($row = $db->sql_fetchrow($result)) {
$portal_menus[] = $row;
}
$db->sql_freeresult($result);
if (!function_exists('group_memberships')) {
include $phpbb_root_path . 'includes/functions_user.' . $phpEx;
}
$memberships = array();
$memberships = group_memberships(false, $user->data['user_id'], false);
$menu_count = count($portal_menus);
for ($i = 0; $i < $menu_count; $i++) {
$u_id = '';
// initiate our var user u_id, if we need to pass user id
$isamp = '';
// initiate our var isamp, if we need to use it
$menu_view_groups = $portal_menus[$i]['view_groups'];
$menu_item_view_all = $portal_menus[$i]['view_all'];
$process_menu_item = false;
// skip process if everyone can view this menus //
if ($menu_item_view_all == 0) {
$grps = explode(",", $menu_view_groups);
if ($memberships) {
foreach ($memberships as $member) {
for ($j = 0; $j < count($grps); $j++) {
示例14: get_group_memberships
function get_group_memberships($user)
{
$groups = array();
$group_set = group_memberships(false, (int) $user);
foreach ($group_set as $group) {
$groups[(int) $group['group_id']] = array('id' => (int) $group['group_id'], 'leader' => (bool) $group['group_leader'], 'pending' => (bool) $group['user_pending']);
}
return $groups;
}
示例15: syncgroups
private function syncgroups()
{
// Si l'utilisateur est login alors voir les groups qu'il a et les ajouter s'il n'existe pas.
// En profiter pour maj l'user
//todo: code la maj du realname
// maj des groups
if (!function_exists('get_group_id')) {
include $this->phpbb_root_path . 'includes/functions_convert.' . $this->php_ext;
}
if (!function_exists('group_memberships')) {
include $this->phpbb_root_path . 'includes/functions_user.' . $this->php_ext;
}
if (!function_exists('get_group_name')) {
include $this->phpbb_root_path . 'includes/functions_user.' . $this->php_ext;
}
$passage_groups = explode(' ', get_apache_header($this->config['passage_groups']));
$phpbb_groups = group_memberships(false, $this->user->data['user_id'], false);
// Append
if (!empty($phpbb_groups) and !empty($passage_groups)) {
foreach ($passage_groups as $p_grg) {
if (is_array($phpbb_groups)) {
if (false == in_array($p_grg, $phpbb_groups)) {
group_user_add(get_group_id($p_grg), $this->user->data['user_id']);
}
}
}
// Clean
if (is_array($phpbb_groups)) {
foreach ($phpbb_groups as $bb_grp) {
if (false == in_array(get_group_name($bb_grp['group_id']), $passage_groups)) {
group_user_del($bb_grp['group_id'], $this->user->data['user_id']);
}
}
}
}
}