• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

PHP fetch_membergroupids_array函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中fetch_membergroupids_array函数的典型用法代码示例。如果您正苦于以下问题:PHP fetch_membergroupids_array函数的具体用法?PHP fetch_membergroupids_array怎么用?PHP fetch_membergroupids_array使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了fetch_membergroupids_array函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: can_use_prefix

/**
 * Prefix Permission Check
 *
 * @param	string	The prefix ID to check
 * @param	array	The restricted usergroups (used when we have the restrictions already)
 *
 * @return 	boolean
 */
function can_use_prefix($prefixid, $restrictions = null)
{
    global $vbulletin;
    if (!is_array($restrictions)) {
        $restrictions = array();
        $restrictions_db = $vbulletin->db->query_read("\n\t\t\tSELECT prefixpermission.usergroupid\n\t\t\tFROM " . TABLE_PREFIX . "prefixpermission AS prefixpermission\n\t\t\tWHERE prefixpermission.prefixid = '" . $vbulletin->db->escape_string($prefixid) . "'\n\t\t");
        while ($restriction = $vbulletin->db->fetch_array($restrictions_db)) {
            $restrictions[] = intval($restriction['usergroupid']);
        }
    }
    if (empty($restrictions)) {
        return true;
    }
    $membergroups = fetch_membergroupids_array($vbulletin->userinfo);
    $infractiongroups = explode(',', str_replace(' ', '', $vbulletin->userinfo['infractiongroupids']));
    foreach ($restrictions as $usergroup) {
        if (in_array($usergroup, $infractiongroups)) {
            return false;
        }
    }
    if (!count(array_diff($membergroups, $restrictions))) {
        return false;
    }
    return true;
}
开发者ID:0hyeah,项目名称:yurivn,代码行数:33,代码来源:functions_prefix.php


示例2: array

/**
 * Fetches the Avatar Category Cache
 *
 * @param	array	User Information
 *
 * @return	array	Avatar Category Cache
 *
 */
function &fetch_avatar_categories(&$userinfo)
{
    global $vbulletin;
    static $categorycache = array();
    if (isset($categorycache["{$userinfo['userid']}"])) {
        return $categorycache["{$userinfo['userid']}"];
    } else {
        $categorycache["{$userinfo['userid']}"] = array();
    }
    $membergroups = fetch_membergroupids_array($userinfo);
    $infractiongroups = explode(',', str_replace(' ', '', $userinfo['infractiongroupids']));
    // ############### DISPLAY AVATAR CATEGORIES ###############
    // get all the available avatar categories
    $avperms = $vbulletin->db->query_read_slave("\n\t\tSELECT imagecategorypermission.imagecategoryid, usergroupid\n\t\tFROM " . TABLE_PREFIX . "imagecategorypermission AS imagecategorypermission, " . TABLE_PREFIX . "imagecategory AS imagecategory\n\t\tWHERE imagetype = 1\n\t\t\tAND imagecategorypermission.imagecategoryid = imagecategory.imagecategoryid\n\t\tORDER BY imagecategory.displayorder\n\t");
    $noperms = array();
    while ($avperm = $vbulletin->db->fetch_array($avperms)) {
        $noperms["{$avperm['imagecategoryid']}"][] = $avperm['usergroupid'];
    }
    foreach ($noperms as $imagecategoryid => $usergroups) {
        foreach ($usergroups as $usergroupid) {
            if (in_array($usergroupid, $infractiongroups)) {
                $badcategories .= ",{$imagecategoryid}";
            }
        }
        if (!count(array_diff($membergroups, $usergroups))) {
            $badcategories .= ",{$imagecategoryid}";
        }
    }
    $categories = $vbulletin->db->query_read_slave("\n\t\tSELECT imagecategory.*, COUNT(avatarid) AS avatars\n\t\tFROM " . TABLE_PREFIX . "imagecategory AS imagecategory\n\t\tLEFT JOIN " . TABLE_PREFIX . "avatar AS avatar ON\n\t\t\t(avatar.imagecategoryid=imagecategory.imagecategoryid)\n\t\tWHERE imagetype=1\n\t\tAND avatar.minimumposts <= " . intval($userinfo['posts']) . "\n\t\tAND avatar.avatarid <> " . intval($userinfo['avatarid']) . "\n\t\tAND imagecategory.imagecategoryid NOT IN (0{$badcategories})\n\t\tGROUP BY imagecategory.imagecategoryid\n\t\tHAVING avatars > 0\n\t\tORDER BY imagecategory.displayorder\n\t");
    while ($category = $vbulletin->db->fetch_array($categories)) {
        $categorycache["{$userinfo['userid']}"]["{$category['imagecategoryid']}"] = $category;
    }
    return $categorycache["{$userinfo['userid']}"];
}
开发者ID:cedwards-reisys,项目名称:nexus-web,代码行数:42,代码来源:functions_user.php


示例3: prepare_project_permissions

/**
* Prepares the project permissions for a user, taking into account primary and
* secondary groups.
*
* @param	array	(In/Out) User information
*
* @return	array	Project permissions (also in $user['projectpermissions'])
*/
function prepare_project_permissions(&$user)
{
    global $vbulletin;
    $membergroupids = fetch_membergroupids_array($user);
    // build usergroup permissions
    if (sizeof($membergroupids) == 1 or !($vbulletin->usergroupcache["{$user['usergroupid']}"]['genericoptions'] & $vbulletin->bf_ugp_genericoptions['allowmembergroups'])) {
        // if primary usergroup doesn't allow member groups then get rid of them!
        $membergroupids = array($user['usergroupid']);
        // just return the permissions for the user's primary group (user is only a member of a single group)
        $user['projectpermissions'] = $vbulletin->pt_permissions["{$user['usergroupid']}"];
        if (!is_array($user['projectpermissions'])) {
            $user['projectpermissions'] = array();
        }
    } else {
        $user['projectpermissions'] = array();
        // return the merged array of all user's membergroup permissions (user has additional member groups)
        foreach ($membergroupids as $usergroupid) {
            if (!is_array($vbulletin->pt_permissions["{$usergroupid}"])) {
                continue;
            }
            if (!($vbulletin->usergroupcache["{$usergroupid}"]['ptpermissions'] & $vbulletin->bf_ugp_ptpermissions['canviewprojecttools'])) {
                // group's access is globally disabled, skip counting their permissions
                continue;
            }
            foreach ($vbulletin->pt_permissions["{$usergroupid}"] as $projectid => $types) {
                foreach ($types as $type => $value) {
                    foreach ($value as $key => $val) {
                        $user['projectpermissions']["{$projectid}"]["{$type}"]["{$key}"] |= intval($val);
                    }
                }
            }
        }
    }
    if ($user['infractiongroupids']) {
        foreach (explode(',', str_replace(' ', '', $user['infractiongroupids'])) as $usergroupid) {
            foreach ($vbulletin->pt_permissions["{$usergroupid}"] as $projectid => $types) {
                foreach ($types as $type => $value) {
                    foreach ($value as $key => $val) {
                        $user['projectpermissions']["{$projectid}"]["{$type}"]["{$key}"] &= intval($val);
                    }
                }
            }
        }
    }
    return $user['projectpermissions'];
}
开发者ID:holandacz,项目名称:nb4,代码行数:54,代码来源:functions_projecttools.php


示例4: cache_calendar_permissions

/**
* Sets the calendar permissions to the passed user info array
*
* @param	array	(ref) User info array
*
* @return	array	Calendar permissions component of user info array
*/
function cache_calendar_permissions(&$user)
{
	global $calendarcache;
	global $vbulletin;

	$cpermscache = array();
	$calendarcache = array();
	$displayorder = array();

	//we should move this stuff to a user object.
	if (!empty($user['infractiongroupids']))
	{
		$infractiongroupids = explode(',', str_replace(' ', '', $user['infractiongroupids']));
	}
	else
	{
		$infractiongroupids = array();
	}

	// initialise $membergroups - make an array of the usergroups to which this user belongs
	$membergroupids = fetch_membergroupids_array($user);

	// build usergroup permissions
	if (sizeof($membergroupids) == 1 OR
		!($vbulletin->usergroupcache["$user[usergroupid]"]['genericoptions'] &
		$vbulletin->bf_ugp_genericoptions['allowmembergroups'])
	)
	{
		// if primary usergroup doesn't allow member groups then get rid of them!
		$membergroupids = array($user['usergroupid']);
	}

	$calendarpermissions = $vbulletin->db->query_read_slave("
		SELECT calendarpermission.usergroupid, calendarpermission.calendarpermissions,
			calendar.calendarid,calendar.title, displayorder
		FROM " . TABLE_PREFIX . "calendar AS calendar
		LEFT JOIN " . TABLE_PREFIX . "calendarpermission AS calendarpermission ON
			(calendarpermission.calendarid = calendar.calendarid AND
				usergroupid IN (" . implode(', ', $membergroupids) . "))
		ORDER BY displayorder ASC
	");
	while ($cp = $vbulletin->db->fetch_array($calendarpermissions))
	{
		$cpermscache["$cp[calendarid]"]["$cp[usergroupid]"] = intval($cp['calendarpermissions']);
		$calendarcache["$cp[calendarid]"] = $cp['title'];
		$displayorder["$cp[calendarid]"] = $cp['displayorder'];
	}
	$vbulletin->db->free_result($calendarpermissions);

	// Combine the calendar permissions for all member groups
	foreach ($cpermscache AS $calendarid => $cpermissions)
	{
		$user['calendarpermissions']["$calendarid"] = 0;

		if (empty($displayorder["$calendarid"]))
		{
			// leave permissions at 0 for calendars that aren't being displayed
			continue;
		}

		foreach ($membergroupids AS $usergroupid)
		{
			if (isset($cpermissions["$usergroupid"]))
			{
				$user['calendarpermissions']["$calendarid"] |= $cpermissions["$usergroupid"];
			}
			else
			{
				$user['calendarpermissions']["$calendarid"] |= $vbulletin->usergroupcache["$usergroupid"]['calendarpermissions'];
			}
		}
		foreach ($infractiongroupids AS $usergroupid)
		{
			if (isset($cpermissions["$usergroupid"]))
			{
				$user['calendarpermissions']["$calendarid"] &= $cpermissions["$usergroupid"];
			}
			else
			{
				$user['calendarpermissions']["$calendarid"] &= $vbulletin->usergroupcache["$usergroupid"]['calendarpermissions'];
			}
		}
	}
	return $user['calendarpermissions'];
}
开发者ID:hungnv0789,项目名称:vhtm,代码行数:92,代码来源:functions.php


示例5: prepare_output

 /**
  * Prepare any data needed for the output
  *
  * @param	string	The id of the block
  * @param	array	Options specific to the block
  */
 function prepare_output($id = '', $options = array())
 {
     global $show, $vbphrase;
     $this->block_data = array();
     $membergroups = fetch_membergroupids_array($this->profile->userinfo);
     $this->block_data['membergroupcount'] = 0;
     $membergroupbits = '';
     foreach ($membergroups as $usergroupid) {
         $usergroup = $this->registry->usergroupcache["{$usergroupid}"];
         if ($usergroup['ispublicgroup']) {
             $templater = vB_Template::create('memberinfo_publicgroupbit');
             $templater->register('usergroup', $usergroup);
             $membergroupbits .= $templater->render();
             $this->block_data['membergroupcount']++;
         }
     }
     $this->block_data['membergroupbits'] = $membergroupbits;
     if ($this->registry->options['socnet'] & $this->registry->bf_misc_socnet['enable_groups']) {
         $socialgroups = $this->registry->db->query_read_slave("\n\t\t\t\tSELECT socialgroup.groupid, socialgroup.name, socialgroup.description, socialgroup.dateline, sgicon.dateline AS icondateline,\n\t\t\t\t\tsgicon.thumbnail_width AS iconthumb_width, sgicon.thumbnail_height AS iconthumb_height\n\t\t\t\tFROM " . TABLE_PREFIX . "socialgroupmember AS socialgroupmember\n\t\t\t\tINNER JOIN " . TABLE_PREFIX . "socialgroup AS socialgroup ON\n\t\t\t\t\t(socialgroup.groupid = socialgroupmember.groupid)\n\t\t\t\tLEFT JOIN " . TABLE_PREFIX . "socialgroupicon AS sgicon ON sgicon.groupid = socialgroup.groupid\n\t\t\t\tWHERE\n\t\t\t\t\tsocialgroupmember.userid = " . $this->profile->userinfo['userid'] . "\n\t\t\t\t\tAND socialgroupmember.type = 'member'\n\t\t\t\tORDER BY socialgroup.name\n\t\t\t");
         $showgrouplink = $this->registry->userinfo['permissions']['socialgrouppermissions'] & $this->registry->bf_ugp_socialgrouppermissions['canviewgroups'] ? true : false;
         require_once DIR . '/includes/functions_socialgroup.php';
         $socialgroupbits = '';
         $useicons = $this->registry->db->num_rows($socialgroups) <= 12;
         while ($socialgroup = $this->registry->db->fetch_array($socialgroups)) {
             $socialgroup = prepare_socialgroup($socialgroup);
             if (!$useicons) {
                 $socialgroup['name_html'] = fetch_word_wrapped_string(fetch_censored_text($socialgroup['name']));
             }
             if ($useicons) {
                 $templater = vB_Template::create('memberinfo_socialgroupbit');
             } else {
                 $templater = vB_Template::create('memberinfo_socialgroupbit_text');
             }
             $templater->register('showgrouplink', $showgrouplink);
             $templater->register('socialgroup', $socialgroup);
             $socialgroupbits .= $templater->render();
         }
         $this->block_data['socialgroupbits'] = $socialgroupbits;
         $this->block_data['socialgroupcount'] = $this->registry->db->num_rows($socialgroups);
     } else {
         $this->block_data['socialgroupbits'] = '';
         $this->block_data['socialgroupcount'] = 0;
     }
     $this->block_data['show_join_link'] = ((!empty($this->block_data['socialgroupbits']) or $this->profile->prepared['myprofile']) and $this->registry->userinfo['permissions']['socialgrouppermissions'] & $this->registry->bf_ugp_socialgrouppermissions['canjoingroups'] and $this->registry->options['socnet'] & $this->registry->bf_misc_socnet['enable_groups']);
 }
开发者ID:0hyeah,项目名称:yurivn,代码行数:51,代码来源:class_profileblock.php


示例6: unset

     }
 }
 unset($usergroup);
 // count primary users
 $groupcounts = $assertor->assertQuery('vBForum:getPrimaryUsersCount', array(vB_dB_Query::TYPE_KEY => vB_dB_Query::QUERY_STORED));
 if ($groupcounts and $groupcounts->valid()) {
     foreach ($groupcounts as $groupcount) {
         $vbulletin->usergroupcache["{$groupcount['usergroupid']}"]['count'] = $groupcount['total'];
     }
 }
 unset($groupcount);
 // count secondary users
 $groupcounts = $assertor->assertQuery('user', array(vB_dB_Query::TYPE_KEY => vB_dB_Query::QUERY_SELECT, vB_dB_Query::CONDITIONS_KEY => array(array('field' => 'membergroupids', 'value' => '', 'operator' => vB_dB_Query::OPERATOR_NE))));
 if ($groupcounts and $groupcounts->valid()) {
     foreach ($groupcounts as $groupcount) {
         $ids = fetch_membergroupids_array($groupcount, false);
         foreach ($ids as $index => $value) {
             if ($groupcount['usergroupid'] != $value and !empty($vbulletin->usergroupcache["{$value}"])) {
                 $vbulletin->usergroupcache["{$value}"]['secondarycount']++;
             }
         }
     }
 }
 unset($groupcount);
 // count requests
 $groupcounts = $assertor->assertQuery('vBForum:getUserGroupReqeustCount', array(vB_dB_Query::QUERY_STORED));
 if ($groupcounts and $groupcounts->valid()) {
     foreach ($groupcounts as $groupcount) {
         $vbulletin->usergroupcache["{$groupcount['usergroupid']}"]['requests'] = $groupcount['total'];
     }
 }
开发者ID:cedwards-reisys,项目名称:nexus-web,代码行数:31,代码来源:usergroup.php


示例7: nntp_update_groupaccess_cache

function nntp_update_groupaccess_cache($userinfo)
{
    global $vbulletin;
    // Sort groups, to make same key for any combinations
    $membergroupids = fetch_membergroupids_array($userinfo);
    sort($membergroupids);
    $activegroups = array();
    $availablegroups = array();
    /**
     * Example:
     *
     * $nntp_group = new NNTPGate_Forum_Group(); // child of NNTPGate_Group_Base
     * $groups = $nntp_group->get_avaliable_group_list($membergroupids);
     * $activegroups = $activegroups + $groups;
     * unset($nntp_group);
     */
    ($hook = vBulletinHook::fetch_hook('nntp_gate_backend_check_groups_list')) ? eval($hook) : false;
    foreach ($activegroups as $nntpid => $group) {
        if ($group['available'] == true) {
            $availablegroups[] = $group['group_id'];
        }
    }
    sort($availablegroups);
    $nntpgroupslist = implode(',', $availablegroups);
    $template = vB_Template::create('nntp_message_template')->render();
    $css = vB_Template::create('nntp_message_css')->render();
    $menu = vB_Template::create('nntp_message_menu')->render();
    $key = implode(',', $membergroupids);
    // update/insert data into db cache
    $vbulletin->db->query_write("\n        REPLACE INTO `" . TABLE_PREFIX . "nntp_groupaccess_cache`\n        SET\n            `usergroupslist` = '" . $vbulletin->db->escape_string($key) . "',\n            `nntpgroupslist` = '" . $vbulletin->db->escape_string($nntpgroupslist) . "',\n            `template`       = '" . $vbulletin->db->escape_string($template) . "',\n            `css`            = '" . $vbulletin->db->escape_string($css) . "',\n            `menu`           = '" . $vbulletin->db->escape_string($menu) . "'\n    ");
    return $key;
}
开发者ID:rcdesign-cemetery,项目名称:vb-nntp,代码行数:32,代码来源:nntpauth.php


示例8: fetch_membergroupids_array

//	'maxfilelimit' => 100,
//);
// ######################## SET HSJS COUNTER ##############################
$photoplog['hscnt'] = 0;
// ##################### GRAB REQUIRED FUNCTIONS ##########################
require_once DIR . '/includes/adminfunctions.php';
if (is_file($vbulletin->options['photoplog_full_path'] . '/functions.php')) {
    require_once $vbulletin->options['photoplog_full_path'] . '/functions.php';
} else {
    echo "<br /><br /><strong>\r\n\t\tIncorrect PhotoPlog setting! Go to \r\n\t\tACP -> PhotoPlog Pro -> General Settings and make the correction.\r\n\t\t</strong><br /><br />";
    exit;
}
// ################# SET USERGROUPS FOR PERMISSIONS #######################
$photoplog_perm_usergroupid = $vbulletin->userinfo['usergroupid'];
// fetch_membergroupids_array with true includes both primary and secondaries
$photoplog_perm_membergroups_array = fetch_membergroupids_array($vbulletin->userinfo, true);
if (!($vbulletin->usergroupcache[$photoplog_perm_usergroupid]['genericoptions'] & $vbulletin->bf_ugp_genericoptions['allowmembergroups'])) {
    $photoplog_perm_membergroups_array = array($photoplog_perm_usergroupid);
}
foreach ($photoplog_perm_membergroups_array as $photoplog_perm_key => $photoplog_perm_val) {
    $photoplog_perm_membergroups_array[$photoplog_perm_key] = intval($photoplog_perm_val);
}
if (!$photoplog_perm_membergroups_array) {
    $photoplog_perm_membergroups_array = array(0);
}
// #################### SET CATID FOR PERMISSIONS #########################
$vbulletin->input->clean_array_gpc('g', array('n' => TYPE_UINT, 'c' => TYPE_UINT, 'm' => TYPE_UINT));
$vbulletin->input->clean_array_gpc('p', array('fileid' => TYPE_UINT, 'catid' => TYPE_UINT, 'commentid' => TYPE_UINT));
// get or post, not both, so it is max of zero and something else
$photoplog_perm_fileid = max($vbulletin->GPC['n'], $vbulletin->GPC['fileid']);
$photoplog_perm_catid = max($vbulletin->GPC['c'], $vbulletin->GPC['catid']);
开发者ID:holandacz,项目名称:nb4,代码行数:31,代码来源:permissions.php


示例9: USING

             $delete[] = $requestid;
             break;
         case 0:
             // this request will be denied
             $deny[] = $requestid;
             $delete[] = $requestid;
             break;
     }
 }
 // if we have any accepted requests, make sure they are valid
 if (!empty($delete)) {
     $users = $db->query_read_slave("\n\t\t\tSELECT req.userid, user.username, user.usergroupid, user.membergroupids, req.usergrouprequestid\n\t\t\tFROM " . TABLE_PREFIX . "usergrouprequest AS req\n\t\t\tINNER JOIN " . TABLE_PREFIX . "user AS user USING(userid)\n\t\t\tWHERE usergrouprequestid IN(" . implode(', ', $delete) . ")\n\t\t\tORDER BY user.username\n\t\t");
     $authusers = array();
     $denyusers = array();
     while ($user = $db->fetch_array($users)) {
         if (!in_array($vbulletin->GPC['usergroupid'], fetch_membergroupids_array($user)) and in_array($user['usergrouprequestid'], $auth)) {
             $authusers[$user['userid']] = $user['usergrouprequestid'];
         } elseif (in_array($user['usergrouprequestid'], $deny)) {
             $denyusers[$user['userid']] = $user['usergrouprequestid'];
         }
     }
 }
 // check that we STILL have some valid requests
 if (!empty($authusers)) {
     $updateQuery = "\n\t\t\tUPDATE " . TABLE_PREFIX . "user SET\n\t\t\tmembergroupids = IF(membergroupids = '', " . $vbulletin->GPC['usergroupid'] . ", CONCAT(membergroupids, '," . $vbulletin->GPC['usergroupid'] . "'))\n\t\t\tWHERE userid IN(" . implode(', ', array_keys($authusers)) . ")\n\t\t";
     $db->query_write($updateQuery);
 }
 ($hook = vBulletinHook::fetch_hook('joinrequest_process_complete')) ? eval($hook) : false;
 // delete processed join requests
 if (!empty($delete)) {
     $deleteQuery = "\n\t\t\tDELETE FROM " . TABLE_PREFIX . "usergrouprequest\n\t\t\tWHERE usergrouprequestid IN(" . implode(', ', $delete) . ")\n\t\t";
开发者ID:0hyeah,项目名称:yurivn,代码行数:31,代码来源:joinrequests.php


示例10: array

}
// #############################################################################
if ($_POST['do'] == 'order') {
    $vbulletin->input->clean_array_gpc('p', array('subscriptionids' => TYPE_ARRAY_NOHTML, 'currency' => TYPE_ARRAY_NOHTML));
    if (empty($vbulletin->GPC['subscriptionids'])) {
        eval(standard_error(fetch_error('invalidid', $vbphrase['subscription'], $vbulletin->options['contactuslink'])));
    } else {
        $subscriptionid = array_keys($vbulletin->GPC['subscriptionids']);
        $subscriptionid = intval($subscriptionid[0]);
    }
    $sub = $subobj->subscriptioncache["{$subscriptionid}"];
    // first check this is active if not die
    if (!$sub['active']) {
        eval(standard_error(fetch_error('invalidid', $vbphrase['subscription'], $vbulletin->options['contactuslink'])));
    }
    $membergroupids = fetch_membergroupids_array($vbulletin->userinfo);
    $allow_secondary_groups = $vbulletin->bf_ugp_genericoptions['allowmembergroups'] & $vbulletin->usergroupcache[$vbulletin->userinfo['usergroupid']]['genericoptions'];
    if (!empty($sub['deniedgroups']) and ($allow_secondary_groups and !count(array_diff($membergroupids, $sub['deniedgroups'])) or !$allow_secondary_groups and in_array($vbulletin->userinfo['usergroupid'], $sub['deniedgroups']))) {
        eval(standard_error(fetch_error('invalidid', $vbphrase['subscription'], $vbulletin->options['contactuslink'])));
    }
    $sub['title'] = $vbphrase['sub' . $sub['subscriptionid'] . '_title'];
    $sub['description'] = $vbphrase['sub' . $sub['subscriptionid'] . '_desc'];
    $currency = $vbulletin->GPC['currency']["{$subscriptionid}"];
    $tmp = explode('_', $currency);
    $currency = $tmp[1];
    $subscriptionsubid = intval($tmp[0]);
    unset($tmp);
    $costs = unserialize($sub['cost']);
    if ($costs["{$subscriptionsubid}"]['length'] == 1) {
        $subscription_units = $lengths[$costs["{$subscriptionsubid}"]['units']];
    } else {
开发者ID:0hyeah,项目名称:yurivn,代码行数:31,代码来源:payments.php


示例11: cache_permissions

/**
* Returns the full set of permissions for the specified user (called by global or init)
*
* @param	array	(ref) User info array
* @param	boolean	If true, returns combined usergroup permissions, individual forum permissions, individual calendar permissions and attachment permissions
* @param boolean        Reset the accesscache array for permissions following access mask update. Only allows one reset.
*
* @return	array	Permissions component of user info array
*/
function cache_permissions(&$user, $getforumpermissions = true, $resetaccess = false)
{
    global $vbulletin, $forumpermissioncache;
    // these are the arrays created by this function
    global $calendarcache;
    static $accesscache = array(), $reset;
    if ($resetaccess and !$reset) {
        // Reset the accesscache array for permissions following access mask update. Only allows one reset.
        $accesscache = array();
        $reset = true;
    }
    $intperms = array();
    // set the usergroupid of the user's primary usergroup
    $USERGROUPID = $user['usergroupid'];
    if ($USERGROUPID == 0) {
        // set a default usergroupid if none is set
        $USERGROUPID = 1;
    }
    // initialise $membergroups - make an array of the usergroups to which this user belongs
    $membergroupids = fetch_membergroupids_array($user);
    // build usergroup permissions
    if (sizeof($membergroupids) == 1 or !($vbulletin->usergroupcache["{$USERGROUPID}"]['genericoptions'] & $vbulletin->bf_ugp_genericoptions['allowmembergroups'])) {
        // if primary usergroup doesn't allow member groups then get rid of them!
        $membergroupids = array($USERGROUPID);
        // just return the permissions for the user's primary group (user is only a member of a single group)
        $user['permissions'] = $vbulletin->usergroupcache["{$USERGROUPID}"];
    } else {
        // return the merged array of all user's membergroup permissions (user has additional member groups)
        foreach ($membergroupids as $usergroupid) {
            foreach ($vbulletin->bf_ugp as $dbfield => $permfields) {
                $user['permissions']["{$dbfield}"] |= $vbulletin->usergroupcache["{$usergroupid}"]["{$dbfield}"];
            }
            foreach ($vbulletin->bf_misc_intperms as $dbfield => $precedence) {
                // put in some logic to handle $precedence
                if (!isset($intperms["{$dbfield}"])) {
                    $intperms["{$dbfield}"] = $vbulletin->usergroupcache["{$usergroupid}"]["{$dbfield}"];
                } else {
                    if (!$precedence) {
                        if ($vbulletin->usergroupcache["{$usergroupid}"]["{$dbfield}"] > $intperms["{$dbfield}"]) {
                            $intperms["{$dbfield}"] = $vbulletin->usergroupcache["{$usergroupid}"]["{$dbfield}"];
                        }
                    } else {
                        if ($vbulletin->usergroupcache["{$usergroupid}"]["{$dbfield}"] == 0 or isset($intperms["{$dbfield}"]) and $intperms["{$dbfield}"] == 0) {
                            $intperms["{$dbfield}"] = 0;
                        } else {
                            if ($vbulletin->usergroupcache["{$usergroupid}"]["{$dbfield}"] > $intperms["{$dbfield}"]) {
                                $intperms["{$dbfield}"] = $vbulletin->usergroupcache["{$usergroupid}"]["{$dbfield}"];
                            }
                        }
                    }
                }
            }
        }
        $user['permissions'] = array_merge($vbulletin->usergroupcache["{$USERGROUPID}"], $user['permissions'], $intperms);
    }
    if ($user['infractiongroupids']) {
        $infractiongroupids = explode(',', str_replace(' ', '', $user['infractiongroupids']));
    } else {
        $infractiongroupids = array();
    }
    foreach ($infractiongroupids as $usergroupid) {
        foreach ($vbulletin->bf_ugp as $dbfield => $permfields) {
            $user['permissions']["{$dbfield}"] &= $vbulletin->usergroupcache["{$usergroupid}"]["{$dbfield}"];
        }
        foreach ($vbulletin->bf_misc_intperms as $dbfield => $precedence) {
            if (!$precedence) {
                if ($vbulletin->usergroupcache["{$usergroupid}"]["{$dbfield}"] < $user['permissions']["{$dbfield}"]) {
                    $user['permissions']["{$dbfield}"] = $vbulletin->usergroupcache["{$usergroupid}"]["{$dbfield}"];
                }
            } else {
                if ($vbulletin->usergroupcache["{$usergroupid}"]["{$dbfield}"] < $user['permissions']["{$dbfield}"] and $vbulletin->usergroupcache["{$usergroupid}"]["{$dbfield}"] != 0) {
                    $user['permissions']["{$dbfield}"] = $vbulletin->usergroupcache["{$usergroupid}"]["{$dbfield}"];
                }
            }
        }
    }
    if (defined('SKIP_SESSIONCREATE') and $user['userid'] == $vbulletin->userinfo['userid'] and !($user['permissions']['forumpermissions'] & $vbulletin->bf_ugp_forumpermissions['canview'])) {
        // grant canview for usergroup if session skipping is defined.
        $user['permissions']['forumpermissions'] += $vbulletin->bf_ugp_forumpermissions['canview'];
    }
    ($hook = vBulletinHook::fetch_hook('cache_permissions')) ? eval($hook) : false;
    // if we do not need to grab the forum/calendar permissions
    // then just return what we have so far
    if ($getforumpermissions == false) {
        return $user['permissions'];
    }
    if (!is_array($user['forumpermissions'])) {
        $user['forumpermissions'] = array();
    }
    foreach (array_keys($vbulletin->forumcache) as $forumid) {
        if (!isset($user['forumpermissions']["{$forumid}"])) {
//.........这里部分代码省略.........
开发者ID:holandacz,项目名称:nb4,代码行数:101,代码来源:functions.php


示例12: verify_iconid

 /**
  * Verifies that the icon selected is valid.
  *
  * @param	integer	The ID of the icon
  *
  * @return	bool	Whether the icon is valid
  */
 function verify_iconid(&$iconid)
 {
     if ($iconid) {
         // try to improve permission checking on icons
         if (!$this->info['user']) {
             $userid = $this->fetch_field('userid');
             if (!$userid) {
                 $userid = $this->fetch_field('postuserid');
             }
             $this->set_info('user', fetch_userinfo($userid));
         }
         if ($this->info['user']) {
             $membergroups = fetch_membergroupids_array($this->info['user']);
         } else {
             // this is assumed to be a guest; go magic numbers!
             $membergroups = array(1);
         }
         $imagecheck = $this->dbobject->query_read_slave("\n\t\t\t\tSELECT usergroupid FROM " . TABLE_PREFIX . "icon AS icon\n\t\t\t\tINNER JOIN " . TABLE_PREFIX . "imagecategorypermission USING (imagecategoryid)\n\t\t\t\tWHERE icon.iconid = {$iconid}\n\t\t\t\t\tAND usergroupid IN (" . $this->dbobject->escape_string(implode(',', $membergroups)) . ")\n\t\t\t");
         if ($this->dbobject->num_rows($imagecheck) == sizeof($membergroups)) {
             $iconid = 0;
         }
     }
     return true;
 }
开发者ID:benyamin20,项目名称:vbregistration,代码行数:31,代码来源:class_dm_threadpost.php


示例13: updateMemberForDeletedUsergroup

 public function updateMemberForDeletedUsergroup($params, $db, $check_only = false)
 {
     if ($check_only) {
         return !empty($params['users']) and !empty($params['usergroupid']);
     } else {
         $casesql = $casesqli = '';
         $updateusers = $updateusersi = array();
         foreach ($params['users'] as $user) {
             if (!empty($user['membergroupids'])) {
                 $membergroups = fetch_membergroupids_array($user, false);
                 foreach ($membergroups as $key => $val) {
                     if ($val == $params['usergroupid']) {
                         unset($membergroups["{$key}"]);
                     }
                 }
                 $user['membergroupids'] = implode(',', $membergroups);
                 $casesql .= "WHEN {$user['userid']} THEN '{$user['membergroupids']}' ";
                 $updateusers[] = $user['userid'];
             }
             if (!empty($user['infractiongroupids'])) {
                 $infractiongroups = explode(',', str_replace(' ', '', $user['infractiongroupids']));
                 foreach ($infractiongroups as $key => $val) {
                     if ($val == $params['usergroupid']) {
                         unset($infractiongroups["{$key}"]);
                     }
                 }
                 $user['infractiongroupids'] = implode(',', $infractiongroups);
                 $casesqli .= "WHEN {$user['userid']} THEN '{$user['infractiongroupids']}' ";
                 $updateusersi[] = $user['userid'];
             }
         }
         // do a big update to get rid of this usergroup from matched members' membergroupids
         if (!empty($casesql)) {
             $sql = "\n\t\t\t\t\tUPDATE " . TABLE_PREFIX . "user SET\n\t\t\t\t\tmembergroupids = CASE userid\n\t\t\t\t\t{$casesql}\n\t\t\t\t\tELSE '' END\n\t\t\t\t\tWHERE userid IN(" . implode(',', $updateusers) . ")\n\t\t\t\t";
             $resultclass = 'vB_dB_' . $this->db_type . '_result';
             $result = new $resultclass($db, $sql);
             $result->valid();
             unset($result);
         }
         // do a big update to get rid of this usergroup from matched members' infractiongroupids
         if (!empty($casesqli)) {
             $sql2 = "\n\t\t\t\t\tUPDATE " . TABLE_PREFIX . "user SET\n\t\t\t\t\tinfractiongroupids = CASE userid\n\t\t\t\t\t{$casesqli}\n\t\t\t\t\tELSE '' END\n\t\t\t\t\tWHERE userid IN(" . implode(',', $updateusersi) . ")\n\t\t\t\t";
             $resultclass2 = 'vB_dB_' . $this->db_type . '_result';
             $result2 = new $resultclass2($db, $sql2);
             $result2->valid();
             unset($result2);
         }
         return true;
     }
 }
开发者ID:cedwards-reisys,项目名称:nexus-web,代码行数:50,代码来源:querydefs.php


示例14: construct_icons

/**
* Constructs the posticons selector interface
*
* @param	integer	Selected Icon ID
* @param	boolean	Allow icons?
*
* @return	string	posticons template
*/
function construct_icons($seliconid = 0, $allowicons = true)
{
	// returns the icons chooser for posting new messages
	global $vbulletin;
	global $vbphrase, $selectedicon, $show;

	$selectedicon = array('src' => $vbulletin->options['cleargifurl'], 'alt' => '');

	if (!$allowicons)
	{
		return false;
	}

	$membergroups = fetch_membergroupids_array($vbulletin->userinfo);
	$infractiongroups = explode(',', str_replace(' ', '', $vbulletin->userinfo['infractiongroupids']));

	($hook = vBulletinHook::fetch_hook('posticons_start')) ? eval($hook) : false;

	$avperms = $vbulletin->db->query_read_slave("
		SELECT imagecategorypermission.imagecategoryid, usergroupid
		FROM " . TABLE_PREFIX . "imagecategorypermission AS imagecategorypermission, " . TABLE_PREFIX . "imagecategory AS imagecategory
		WHERE imagetype = 2
			AND imagecategorypermission.imagecategoryid = imagecategory.imagecategoryid
		ORDER BY imagecategory.displayorder
	");
	$noperms = array();
	while ($avperm = $vbulletin->db->fetch_array($avperms))
	{
		$noperms["$avperm[imagecategoryid]"][] = $avperm['usergroupid'];
	}

	$badcategories = '';
	foreach($noperms AS $imagecategoryid => $usergroups)
	{
		foreach($usergroups AS $usergroupid)
		{
			if (in_array($usergroupid, $infractiongroups))
			{
				$badcategories .= ",$imagecategoryid";
			}
		}
		if (!count(array_diff($membergroups, $usergroups)))
		{
			$badcategories .= ",$imagecategoryid";
		}
	}

	$icons = $vbulletin->db->query_read_slave("
		SELECT iconid, iconpath, title
		FROM " . TABLE_PREFIX . "icon AS icon
		WHERE imagecategoryid NOT IN (0$badcategories)
		ORDER BY imagecategoryid, displayorder
	");

	if (!$vbulletin->db->num_rows($icons))
	{
		return false;
	}

	$numicons = 0;
	$show['posticons'] = false;

	while ($icon = $vbulletin->db->fetch_array($icons))
	{
		$numicons++;
		$show['posticons'] = true;
		$show['opentr'] = false;
		$show['closetr'] = false;
		if ($numicons % 7 == 0 AND $numicons != 1)
		{
			$show['closetr'] = true;
		}
		if (($numicons - 1) % 7 == 0 AND $numicons != 1)
		{
			$show['opentr'] = true;
		}

		$iconid = $icon['iconid'];
		$iconpath = $icon['iconpath'];
		$alttext = $icon['title'];
		if ($seliconid == $iconid)
		{
			$iconchecked = 'checked="checked"';
			$selectedicon = array('src' => $iconpath, 'alt' => $alttext);
		}
		else
		{
			$iconchecked = '';
		}

		($hook = vBulletinHook::fetch_hook('posticons_bit')) ? eval($hook) : false;

//.........这里部分代码省略.........
开发者ID:hungnv0789,项目名称:vhtm,代码行数:101,代码来源:functions_newpost.php


示例15: save_fbusergroup

/**
* Saves fb usergroup into the datamanager
*
* @param	vB_DataManager_User, the datamanager to save the fb form info into
*/
function save_fbusergroup($userdata)
{
    global $vbulletin;
    // save additional fb usergroup if specified, making sure it is not already the primary usergroup
    if ($vbulletin->options['facebookusergroupid'] > 0 and $vbulletin->options['facebookusergroupid'] != $userdata->fetch_field('usergroupid')) {
        $membergroupids = fetch_membergroupids_array($vbulletin->userinfo, false);
        $membergroupids[] = $vbulletin->options['facebookusergroupid'];
        $userdata->set('membergroupids', array_unique($membergroupids));
    }
}
开发者ID:0hyeah,项目名称:yurivn,代码行数:15,代码来源:functions_facebook.php


示例16: prepare_output

 /**
  * Prepare any data needed for the output
  *
  * @param	string	The id of the block
  * @param	array	Options specific to the block
  */
 function prepare_output($id = '', $options = array())
 {
     global $show, $vbphrase, $stylevar;
     $this->block_data = array();
     $membergroups = fetch_membergroupids_array($this->profile->userinfo);
     $this->block_data['membergroupcount'] = 0;
     $membergroupbits = '';
     foreach ($membergroups as $usergroupid) {
         $usergroup = $this->registry->usergroupcache["{$usergroupid}"];
         if ($usergroup['ispublicgroup']) {
             eval('$membergroupbits .= "' . fetch_template('memberinfo_publicgroupbit') . '";');
             $this->block_data['membergroupcount']++;
         }
     }
     $this->block_data['membergroupbits'] = $membergroupbits;
     if ($this->registry->options['socnet'] & $this->registry->bf_misc_socnet['enable_groups']) {
         $socialgroups = $this->registry->db->query_read_slave("\n\t\t\t\tSELECT socialgroup.*\n\t\t\t\tFROM " . TABLE_PREFIX . "socialgroupmember AS socialgroupmember\n\t\t\t\tINNER JOIN " . TABLE_PREFIX . "socialgroup AS socialgroup ON\n\t\t\t\t\t(socialgroup.groupid = socialgroupmember.groupid)\n\t\t\t\tWHERE\n\t\t\t\t\tsocialgroupmember.userid = " . $this->profile->userinfo['userid'] . "\n\t\t\t\t\tAND socialgroupmember.type = 'member'\n\t\t\t\tORDER BY socialgroup.name\n\t\t\t");
         $showgrouplink = $this->registry->userinfo['permissions']['socialgrouppermissions'] & $this->registry->bf_ugp_socialgrouppermissions['canviewgroups'] ? true : false;
         $socialgroupbits = '';
         while ($socialgroup = $this->registry->db->fetch_array($socialgroups)) {
             $socialgroup['name_html'] = fetch_word_wrapped_string(fetch_censored_text($socialgroup['name']));
             eval('$socialgroupbits .= "' . fetch_template('memberinfo_socialgroupbit') . '";');
         }
         $this->block_data['socialgroupbits'] = $socialgroupbits;
         $this->block_data['socialgroupcount'] = $this->registry->db->num_rows($socialgroups);
     } else {
         $this->block_data['socialgroupbits'] = '';
         $this->block_data['socialgroupcount'] = 0;
     }
     $this->block_data['show_join_link'] = ((!empty($this->block_data['socialgroupbits']) or $this->profile->prepared['myprofile']) and $this->registry->userinfo['permissions']['socialgrouppermissions'] & $this->registry->bf_ugp_socialgrouppermissions['canjoingroups'] and $this->registry->options['socnet'] & $this->registry->bf_misc_socnet['enable_groups']);
 }
开发者ID:holandacz,项目名称:nb4,代码行数:37,代码来源:class_profileblock.php


示例17: prepare_blog_category_permissions

/**
* Prepares the blog category permissions for a user, taking into account primary and
* secondary groups.
*
* @param	array	(In/Out) User information
*
* @return	array	Category permissions (also in $user['blogcategorypermissions'])
*/
function prepare_blog_category_permissions(&$user, $loadcache = false)
{
	global $vbulletin;

	$membergroupids = fetch_membergroupids_array($user);

	if (sizeof($membergroupids) == 1 OR !($vbulletin->usergroupcache["$user[usergroupid]"]['genericoptions'] & $vbulletin->bf_ugp_genericoptions['allowmembergroups']))
	{
		// if primary usergroup doesn't allow member groups then get rid of them!
		$membergroupids = array($user['usergroupid']);
	}

	$user['blogcategorypermissions'] = array(
		'cantview' => array(),
		'cantpost' => array(),
	);

	if ($vbulletin->blogcategorycache === NULL AND $loadcache)
	{
		// Load the cache
		$v 

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP fetch_microtime_difference函数代码示例发布时间:2022-05-15
下一篇:
PHP fetch_max_upload_size函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap