本文整理汇总了PHP中prepare_socialgroup函数的典型用法代码示例。如果您正苦于以下问题:PHP prepare_socialgroup函数的具体用法?PHP prepare_socialgroup怎么用?PHP prepare_socialgroup使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了prepare_socialgroup函数的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: render
public function render($current_user, $criteria, $template_name = '')
{
global $vbulletin;
if (!strlen($template_name)) {
$template_name = 'search_results_socialgroup';
}
$group = prepare_socialgroup($this->group->get_record());
//some aliasing to make the template happy
$group['categoryid'] = $group['socialgroupcategoryid'];
global $show;
$show['gminfo'] = $vbulletin->options['socnet_groups_msg_enabled'];
$show['pictureinfo'] = ($vbulletin->options['socnet_groups_pictures_enabled']);
$show['pending_link'] = ($this->group->has_modperm('caninvitemoderatemembers', $current_user) AND
$group['moderatedmembers'] > 0);
$show['lastpostinfo'] = ($group['lastposterid']);
$show['category_names'] = true;
$template = vB_Template::create($template_name);
$template->register('lastpostalt', $show['pictureinfo'] ? 'alt2' : 'alt1');
$template->register('group', $group);
$template->register('show', $show);
$template->register('dateformat', $vbulletin->options['dateformat']);
$template->register('timeformat', $vbulletin->options['default_timeformat']);
return $template->render();
}
示例2: fetch_socialgroups_mygroups
/**
* Fetches groups that the current user is a member of
* If iconview is false, then the info for the listview will be fetched.
*
* @param boolean $iconview Selects info for the icon view
* @return array Array of groupinfos
*/
function fetch_socialgroups_mygroups($iconview = true)
{
global $vbulletin;
$result = $vbulletin->db->query_read_slave("\n\t\tSELECT socialgroup.*, socialgroup.dateline AS createdate,\n\t\t\tsocialgroupmember.type AS membertype,\n\t\t\tgroupread.readtime" . ($iconview ? ",sgicon.dateline AS icondateline, sgicon.thumbnail_width AS iconthumb_width, sgicon.thumbnail_height AS iconthumb_height" : ',socialgroupmember.dateline AS joindate, socialgroupmember.type AS membertype, sgc.title AS categoryname, sgc.socialgroupcategoryid AS categoryid') . "\n\t\tFROM " . TABLE_PREFIX . "socialgroupmember AS socialgroupmember\n\t\tINNER JOIN " . TABLE_PREFIX . "socialgroup AS socialgroup ON (socialgroup.groupid = socialgroupmember.groupid)\n\t\tLEFT JOIN " . TABLE_PREFIX . "groupread AS groupread ON (groupread.groupid = socialgroup.groupid\n\t\t\t\t\t\t\t\t\t\tAND groupread.userid = " . $vbulletin->userinfo['userid'] . ")" . ($iconview ? 'LEFT JOIN ' . TABLE_PREFIX . 'socialgroupicon AS sgicon ON sgicon.groupid = socialgroup.groupid' : 'INNER JOIN ' . TABLE_PREFIX . 'socialgroupcategory AS sgc ON (sgc.socialgroupcategoryid = socialgroup.socialgroupcategoryid)') . "\n\t\tWHERE socialgroupmember.userid = " . $vbulletin->userinfo['userid'] . " AND socialgroupmember.type = 'member'\n\t\tORDER BY socialgroupmember.dateline DESC\n\t");
$groups = array();
while ($group = $vbulletin->db->fetch_array($result)) {
$group = prepare_socialgroup($group);
if (!$iconview) {
$group['delete_group'] = can_delete_group($group);
$group['edit_group'] = can_edit_group($group);
$group['leave_group'] = can_leave_group($group);
$group['group_options'] = ($group['delete_group'] or $group['edit_group'] or $group['leave_group']);
}
$groups[] = $group;
}
$vbulletin->db->free_result($result);
return $groups;
}
示例3: standard_error
// #######################################################################
if ($_REQUEST['do'] == 'addgroup') {
if (empty($pictureinfo) or $pictureinfo['state'] == 'moderation') {
standard_error(fetch_error('invalidid', $vbphrase['picture'], $vbulletin->options['contactuslink']));
}
if ($userinfo['userid'] != $vbulletin->userinfo['userid'] or !($vbulletin->options['socnet'] & $vbulletin->bf_misc_socnet['enable_groups']) or !$vbulletin->options['socnet_groups_albums_enabled'] or !($vbulletin->userinfo['permissions']['socialgrouppermissions'] & $vbulletin->bf_ugp_socialgrouppermissions['canviewgroups']) or !($vbulletin->userinfo['permissions']['socialgrouppermissions'] & $vbulletin->bf_ugp_socialgrouppermissions['canjoingroups'])) {
print_no_permission();
}
$groups_sql = $db->query_read_slave("\n\t\tSELECT socialgroup.*, IF(socialgrouppicture.pictureid IS NULL, 0, 1) AS picingroup\n\t\tFROM " . TABLE_PREFIX . "socialgroup AS socialgroup\n\t\tINNER JOIN " . TABLE_PREFIX . "socialgroupmember AS socialgroupmember ON\n\t\t\t(socialgroupmember.groupid = socialgroup.groupid AND socialgroupmember.userid = " . $vbulletin->userinfo['userid'] . ")\n\t\tLEFT JOIN " . TABLE_PREFIX . "socialgrouppicture AS socialgrouppicture ON\n\t\t\t(socialgrouppicture.groupid = socialgroup.groupid AND socialgrouppicture.pictureid = {$pictureinfo['pictureid']})\n\t\tWHERE socialgroupmember.type = 'member'\n\t\t\tAND socialgroup.options & " . $vbulletin->bf_misc_socialgroupoptions['enable_group_albums'] . "\n\t\tORDER BY socialgroup.name\n\t");
if ($db->num_rows($groups_sql) == 0) {
standard_error(fetch_error('not_member_groups_find_some', $vbulletin->session->vars['sessionurl_q']));
}
require_once DIR . '/includes/functions_socialgroup.php';
$groupbits = '';
while ($group = $db->fetch_array($groups_sql)) {
$group = prepare_socialgroup($group);
$group_checked = $group['picingroup'] ? ' checked="checked"' : '';
eval('$groupbits .= "' . fetch_template('album_addgroup_groupbit') . '";');
}
$pictureinfo = prepare_pictureinfo_thumb($pictureinfo, $albuminfo);
($hook = vBulletinHook::fetch_hook('album_picture_addgroups')) ? eval($hook) : false;
// navbar and final output
$navbits = construct_navbits(array('member.php?' . $vbulletin->session->vars['sessionurl'] . "u={$userinfo['userid']}" => construct_phrase($vbphrase['xs_profile'], $userinfo['username']), 'album.php?' . $vbulletin->session->vars['sessionurl'] . "u={$userinfo['userid']}" => $vbphrase['albums'], 'album.php?' . $vbulletin->session->vars['sessionurl'] . "albumid={$albuminfo['albumid']}" => $albuminfo['title_html'], '' => $vbphrase['add_picture_to_groups']));
eval('$navbar = "' . fetch_template('navbar') . '";');
eval('print_output("' . fetch_template('album_addgroup') . '");');
}
// #######################################################################
if ($_REQUEST['do'] == 'report' or $_POST['do'] == 'sendemail') {
require_once DIR . '/includes/class_reportitem.php';
if (!$vbulletin->userinfo['userid']) {
print_no_permission();
示例4: 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']);
}
示例5: fetch_socialgroupinfo
/**
* Fetches information regarding a Social Group
*
* @param integer Group ID
*
* @return array Group Information
*
*/
function fetch_socialgroupinfo($groupid)
{
global $vbulletin;
// This is here for when we are doing inline moderation - it takes away the need to repeatedly query the database
// if we are deleting all the messages in the same group
static $groupcache;
if (is_array($groupcache["{$groupid}"])) {
return $groupcache["{$groupid}"];
}
$groupcache["{$groupid}"] = prepare_socialgroup($vbulletin->db->query_first("\n\t\tSELECT socialgroup.*,\n\t\t\tuser.username AS creatorusername\n\t\t\t" . ($vbulletin->userinfo['userid'] ? ', socialgroupmember.type AS membertype' : '') . "\n\t\tFROM " . TABLE_PREFIX . "socialgroup AS socialgroup\n\t\tLEFT JOIN " . TABLE_PREFIX . "user AS user ON (socialgroup.creatoruserid = user.userid)\n\t\t" . ($vbulletin->userinfo['userid'] ? "LEFT JOIN " . TABLE_PREFIX . "socialgroupmember AS socialgroupmember ON\n\t\t\t\t(socialgroupmember.userid = " . $vbulletin->userinfo['userid'] . " AND socialgroupmember.groupid = socialgroup.groupid)" : '') . "\n\t\tWHERE socialgroup.groupid = " . intval($groupid) . "\n\t"));
return $groupcache["{$groupid}"];
}
示例6: fetch_socialgroup_random_groups
/**
* Fetches random social groups
*
* @return array Array of groupinfos
*/
function fetch_socialgroup_random_groups()
{
global $vbulletin;
$total = $vbulletin->db->query_first("
SELECT COUNT(*) AS total
FROM " . TABLE_PREFIX . "socialgroup AS socialgroup
LEFT JOIN " . TABLE_PREFIX . "socialgroupicon AS sgicon ON (sgicon.groupid = socialgroup.groupid)
");
if (!$total['total'])
{
return array();
}
$hook_query_fields = $hook_query_joins = $hook_query_where = '';
($hook = vBulletinHook::fetch_hook('group_fetch_random')) ? eval($hook) : false;
$sql = "
SELECT socialgroup.*, socialgroup.dateline AS createdate
,sgicon.dateline AS icondateline, sgicon.thumbnail_width AS iconthumb_width, sgicon.thumbnail_height AS iconthumb_height
,sgc.title AS categoryname, sgc.socialgroupcategoryid AS categoryid
FROM " . TABLE_PREFIX ."socialgroup AS socialgroup
LEFT JOIN " . TABLE_PREFIX . "socialgroupicon AS sgicon ON sgicon.groupid = socialgroup.groupid
INNER JOIN " . TABLE_PREFIX . "socialgroupcategory AS sgc ON (sgc.socialgroupcategoryid = socialgroup.socialgroupcategoryid)
$hook_query_joins
$hook_query_where
LIMIT " . vbrand(0, max(--$total['total'],1)) . ", 10
";
$result = $vbulletin->db->query_read_slave($sql);
$groups = array();
while ($group = $vbulletin->db->fetch_array($result))
{
$group = prepare_socialgroup($group, true);
$group['delete_group'] = can_delete_group($group);
$group['edit_group'] = can_edit_group($group);
$group['leave_group'] = can_leave_group($group);
$group['group_options'] = ($group['delete_group'] OR $group['edit_group'] OR $group['leave_group']);
$groups[] = $group;
}
$vbulletin->db->free_result($result);
return $groups;
}
示例7: array
$vbulletin->input->clean_array_gpc('r', array('owngrouppage' => TYPE_STR, 'ajax' => TYPE_BOOL));
if (!$vbulletin->GPC['ajax']) {
$vbulletin->url = 'group.php' . $vbulletin->session->vars['sessionurl_q'];
eval(print_standard_redirect());
}
require_once DIR . '/includes/class_xml.php';
$xml = new vB_AJAX_XML_Builder($vbulletin, 'text/xml');
$xml->add_group('response');
$show['sgicons'] = $vbulletin->options['sg_enablesocialgroupicons'];
$show['messageinfo'] = $vbulletin->options['socnet_groups_msg_enabled'] ? true : false;
$show['pictureinfo'] = ($vbulletin->options['socnet'] & $vbulletin->bf_misc_socnet['enable_albums'] and $vbulletin->options['socnet_groups_albums_enabled']);
if (!($owngroup = fetch_owner_socialgroup($vbulletin->userinfo['userid'], $vbulletin->GPC['owngrouppage']))) {
// leave block unchanged
$xml->add_tag('error', 1);
} else {
$owngroup = prepare_socialgroup($owngroup);
eval('$owngroup = "' . fetch_template('socialgroups_owngroup_bit') . '";');
$xml->add_tag('html', process_replacement_vars($owngroup));
}
$xml->close_group();
$xml->print_xml(true);
}
// #######################################################################
if ($_REQUEST['do'] == 'leave' or $_REQUEST['do'] == 'delete' or $_REQUEST['do'] == 'join') {
if (!$vbulletin->userinfo['userid']) {
print_no_permission();
}
}
// #######################################################################
if ($_REQUEST['do'] == 'leave') {
if (!can_leave_group($group)) {