本文整理汇总了PHP中can_view_private_albums函数的典型用法代码示例。如果您正苦于以下问题:PHP can_view_private_albums函数的具体用法?PHP can_view_private_albums怎么用?PHP can_view_private_albums使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了can_view_private_albums函数的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: fetchCanViewAlbum
protected function fetchCanViewAlbum($albumid)
{
if (!$this->fetchCanViewAlbums() or !($album = $this->content['album'][$albumid])) {
return false;
}
if (!($userinfo = $this->content['user'][$album['userid']])) {
return false;
}
cache_permissions($userinfo, false);
if (!can_moderate(0, 'caneditalbumpicture') and !($userinfo['permissions']['albumpermissions'] & vB::$vbulletin->bf_ugp_albumpermissions['canalbum'])) {
return false;
}
if (!can_view_profile_section($album['userid'], 'albums')) {
// private album that we can not see
return false;
}
require_once DIR . '/includes/functions_album.php';
if ($album['state'] == 'private' and !can_view_private_albums($album['userid'], $album['buddy'])) {
// private album that we can not see
return false;
} else {
if ($album['state'] == 'profile' and !can_view_profile_albums($album['userid'])) {
// profile album that we can not see
return false;
}
}
return true;
}
示例2: construct_online_bit
function construct_online_bit($userinfo, $doall = 0)
{
global $vbulletin, $limitlower, $limitupper, $stylevar, $vbphrase, $ipclass, $show;
global $wol_album, $wol_attachment, $wol_calendar, $wol_event, $wol_inf, $wol_pm, $wol_post, $wol_search, $wol_socialgroup, $wol_thread, $wol_user;
static $count;
$count++;
$show['nopermission'] = false;
$show['lockedout'] = false;
$show['errormessage'] = false;
if ($doall == 1 and ($count > $limitupper or $count < $limitlower)) {
return '';
}
if ($userinfo['attachmentid']) {
$postid = $wol_attachment["{$userinfo['attachmentid']}"];
} else {
$postid = $userinfo['postid'];
}
if ($postid) {
$threadid = $wol_post["{$postid}"];
} else {
$threadid = $userinfo['threadid'];
}
$forumid = $userinfo['forumid'];
$calendarid = $userinfo['calendarid'];
$eventid = $userinfo['eventid'];
$searchid = $userinfo['searchid'];
$groupid = $userinfo['socialgroupid'];
$albumid = $userinfo['albumid'];
if ($albumid) {
require_once DIR . '/includes/functions_album.php';
$albumname = fetch_censored_text($wol_album["{$albumid}"]['title']);
$canviewalbum = true;
if ($wol_album["{$albumid}"]['state'] == 'profile' and !can_view_profile_albums($wol_album["{$albumid}"]['userid'])) {
$canviewalbum = false;
} else {
if ($wol_album["{$albumid}"]['state'] == 'private' and !can_view_private_albums($wol_album["{$albumid}"]['userid'])) {
$canviewalbum = false;
}
}
}
if ($groupid) {
$groupname = fetch_censored_text($wol_socialgroup["{$groupid}"]['name']);
$canviewgroup = true;
}
if ($searchid) {
$searchquery = $wol_search["{$searchid}"]['query'];
$searchuser = $wol_search["{$searchid}"]['searchuser'];
$searchuserid = $wol_search["{$searchid}"]['userid'];
}
if (!$forumid and isset($wol_thread["{$threadid}"]['forumid'])) {
$forumid = $wol_thread["{$threadid}"]['forumid'];
} else {
if (!$forumid and isset($wol_thread["{$wol_post[$postid]}"]['forumid'])) {
$forumid = $wol_thread["{$wol_post[$postid]}"]['forumid'];
}
}
$threadtitle = fetch_censored_text($wol_thread["{$threadid}"]['title']);
$threadprefix = $wol_thread["{$threadid}"]['prefixid'] ? $vbphrase['prefix_' . $wol_thread["{$threadid}"]['prefixid'] . '_title_rich'] . ' ' : '';
$canview = $vbulletin->userinfo['forumpermissions']["{$forumid}"] & $vbulletin->bf_ugp_forumpermissions['canview'];
$canviewothers = $vbulletin->userinfo['forumpermissions']["{$forumid}"] & $vbulletin->bf_ugp_forumpermissions['canviewothers'];
$canviewthreads = $vbulletin->userinfo['forumpermissions']["{$forumid}"] & $vbulletin->bf_ugp_forumpermissions['canviewthreads'];
$postuserid = $wol_thread["{$threadid}"]['postuserid'];
$forumtitle = $vbulletin->forumcache["{$forumid}"]['title'];
$threadpreview = $wol_thread["{$threadid}"]['preview'];
if (!$calendarid and isset($wol_event["{$eventid}"]['calendarid'])) {
$calendarid = $wol_event["{$eventid}"]['calendarid'];
}
$eventtitle = htmlspecialchars_uni($wol_event["{$eventid}"]['title']);
$eventpostuserid = $wol_event["{$eventid}"]['postuserid'];
$calendartitle = $wol_calendar["{$calendarid}"];
$canviewcalendar = $vbulletin->userinfo['calendarpermissions']["{$calendarid}"] & $vbulletin->bf_ugp_calendarpermissions['canviewcalendar'];
$canviewothersevent = $vbulletin->userinfo['calendarpermissions']["{$calendarid}"] & $vbulletin->bf_ugp_calendarpermissions['canviewothersevent'];
if (($wol_thread["{$threadid}"]['isdeleted'] or !$wol_thread["{$threadid}"]['visible']) and !can_moderate($forumid)) {
$threadviewable = 0;
} else {
$threadviewable = 1;
}
if ($threadviewable and $threadtitle and $canview and ($canviewothers or $postuserid == $vbulletin->userinfo['userid']) and verify_forum_password($forumid, $vbulletin->forumcache["{$forumid}"]['password'], false)) {
$seetitle = 1;
}
if ($forumtitle and ($canview or $vbulletin->forumcache["{$forumid}"]['showprivate'] > 1 or !$vbulletin->forumcache["{$forumid}"]['showprivate'] and $vbulletin->options['showprivateforums'])) {
$seeforum = 1;
}
if ($eventtitle and $canviewcalendar and ($canviewothersevent or $eventpostuserid == $vbulletin->userinfo['userid'])) {
$seeevent = 1;
}
if ($calendartitle and $canviewcalendar) {
$seecalendar = 1;
}
if ($vbulletin->userinfo['permissions']['wolpermissions'] & $vbulletin->bf_ugp_wolpermissions['canwhosonlinefull']) {
if ($userinfo['pmid']) {
$seeuserid = $wol_pm["{$userinfo['pmid']}"];
} else {
if ($userinfo['searchid']) {
$seeuserid = $wol_search["{$searchid}"]['targetuserid'];
} else {
if ($userinfo['infractionid']) {
$seeuserid = $wol_inf["{$userinfo['infractionid']}"]['userid'];
} else {
$seeuserid = $userinfo['targetuserid'];
//.........这里部分代码省略.........
示例3: prepare_albuminfo
/**
* Prepares Information Regarding the user's Albums
*
*/
function prepare_albuminfo()
{
if ($this->registry->options['socnet'] & $this->registry->bf_misc_socnet['enable_albums']) {
require_once DIR . '/includes/functions_album.php';
$state = array('public');
if (can_view_private_albums($this->userinfo['userid'])) {
$state[] = 'private';
}
if (can_view_profile_albums($this->userinfo['userid'])) {
$state[] = 'public';
}
$albums = $this->registry->db->query_first_slave("\n\t\t\t\tSELECT COUNT(*) AS albumcount, SUM(album.visible) AS picturecount\n\t\t\t\tFROM " . TABLE_PREFIX . "album AS album\n\t\t\t\tWHERE album.userid = " . $this->userinfo['userid'] . "\n\t\t\t\t\tAND album.state IN ('" . implode("', '", $state) . "')\n\t\t\t");
$this->prepared['albuminfo'] = array('albumcount' => vb_number_format($albums['albumcount']), 'picturecount' => vb_number_format($albums['picturecount']));
}
}
示例4: eval
$show['personalalbum'] = true;
$albumtype = $vbphrase['profile_album_paren'];
}
}
($hook = vBulletinHook::fetch_hook('album_album_complete')) ? 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'], '' => $albuminfo['title_html']));
eval('$navbar = "' . fetch_template('navbar') . '";');
//$headinclude .= '<style type="text/css">#picturebits table { border: 1px solid red; }</style>';
eval('print_output("' . fetch_template('album_picturelist') . '");');
}
// #######################################################################
if ($_REQUEST['do'] == 'user') {
$vbulletin->input->clean_array_gpc('r', array('pagenumber' => TYPE_UINT));
$state = array('public');
if (can_view_private_albums($userinfo['userid'])) {
$state[] = 'private';
}
if (can_view_profile_albums($userinfo['userid'])) {
$state[] = 'profile';
}
$albumcount = $db->query_first("\n\t\tSELECT COUNT(*) AS total\n\t\tFROM " . TABLE_PREFIX . "album\n\t\tWHERE userid = {$userinfo['userid']}\n\t\t\tAND state IN ('" . implode("', '", $state) . "')\n\t");
if ($vbulletin->GPC['pagenumber'] < 1) {
$vbulletin->GPC['pagenumber'] = 1;
}
$perpage = $vbulletin->options['albums_perpage'];
$total_pages = max(ceil($albumcount['total'] / $perpage), 1);
// handle the case of 0 albums
$pagenumber = $vbulletin->GPC['pagenumber'] > $total_pages ? $total_pages : $vbulletin->GPC['pagenumber'];
$start = ($pagenumber - 1) * $perpage;
$hook_query_fields = $hook_query_joins = $hook_query_where = '';
示例5: construct_online_bit
function construct_online_bit($userinfo, $doall = 0)
{
global $vbulletin, $limitlower, $limitupper, $vbphrase, $ipclass, $show;
global $wol_album, $wol_attachment, $wol_calendar, $wol_event, $wol_inf, $wol_pm, $wol_post,
$wol_search, $wol_socialgroup, $wol_thread, $wol_user;
static $count;
$count++;
$show['nopermission'] = false;
$show['lockedout'] = false;
$show['errormessage'] = false;
if ($doall == 1 AND ($count > $limitupper OR $count < $limitlower))
{
return '';
}
if ($userinfo['attachmentid'])
{
$postid = $wol_attachment["$userinfo[attachmentid]"];
}
else
{
$postid = $userinfo['postid'];
}
if ($postid)
{
$threadid = $wol_post["$postid"];
}
else
{
$threadid = $userinfo['threadid'];
}
$forumid = $userinfo['forumid'];
$calendarid = $userinfo['calendarid'];
$eventid = $userinfo['eventid'];
$searchid = $userinfo['searchid'];
$groupid = $userinfo['socialgroupid'];
$albumid = $userinfo['albumid'];
if ($albumid)
{
require_once(DIR . '/includes/functions_album.php');
$albumname = fetch_censored_text($wol_album["$albumid"]['title']);
$canviewalbum = true;
if ($wol_album["$albumid"]['state'] == 'profile' AND !can_view_profile_albums($wol_album["$albumid"]['userid']))
{
$canviewalbum = false;
}
else if ($wol_album["$albumid"]['state'] == 'private' AND !can_view_private_albums($wol_album["$albumid"]['userid']))
{
$canviewalbum = false;
}
}
if ($groupid)
{
$groupname = fetch_censored_text($wol_socialgroup["$groupid"]['name']);
$canviewgroup = true;
}
if ($searchid)
{
$searchquery = $wol_search["$searchid"]['query'];
$searchuser = $wol_search["$searchid"]['searchuser'];
$searchuserid = $wol_search["$searchid"]['userid'];
}
if (!$forumid AND isset($wol_thread["$threadid"]['forumid']))
{
$forumid = $wol_thread["$threadid"]['forumid'];
}
else if (!$forumid AND isset($wol_thread["$wol_post[$postid]"]['forumid']))
{
$forumid = $wol_thread["$wol_post[$postid]"]['forumid'];
}
$threadtitle = fetch_censored_text($wol_thread["$threadid"]['title']);
$threadprefix = ($wol_thread["$threadid"]['prefixid'] ? $vbphrase['prefix_' . $wol_thread["$threadid"]['prefixid'] . '_title_rich'] . ' ' : '');
$canview = $vbulletin->userinfo['forumpermissions']["$forumid"] & $vbulletin->bf_ugp_forumpermissions['canview'];
$canviewothers = $vbulletin->userinfo['forumpermissions']["$forumid"] & $vbulletin->bf_ugp_forumpermissions['canviewothers'];
$canviewthreads = $vbulletin->userinfo['forumpermissions']["$forumid"] & $vbulletin->bf_ugp_forumpermissions['canviewthreads'];
$postuserid = $wol_thread["$threadid"]['postuserid'];
$forumtitle = $vbulletin->forumcache["$forumid"]['title'];
$threadpreview = $wol_thread["$threadid"]['preview'];
if (!$calendarid AND isset($wol_event["$eventid"]['calendarid']))
{
$calendarid = $wol_event["$eventid"]['calendarid'];
}
$eventtitle = htmlspecialchars_uni($wol_event["$eventid"]['title']);
$eventpostuserid = $wol_event["$eventid"]['postuserid'];
$calendartitle = $wol_calendar["$calendarid"];
$canviewcalendar = $vbulletin->userinfo['calendarpermissions']["$calendarid"] & $vbulletin->bf_ugp_calendarpermissions['canviewcalendar'];
$canviewothersevent = $vbulletin->userinfo['calendarpermissions']["$calendarid"] & $vbulletin->bf_ugp_calendarpermissions['canviewothersevent'];
if (($wol_thread["$threadid"]['isdeleted'] OR !$wol_thread["$threadid"]['visible']) AND !can_moderate($forumid))
{
$threadviewable = 0;
}
else
{
//.........这里部分代码省略.........
示例6: 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;
if (is_array($options)) {
$options = array_merge($this->option_defaults, $options);
} else {
$options = $this->option_defaults;
}
require_once DIR . '/includes/functions_album.php';
$state = array('public');
if (can_view_private_albums($this->profile->userinfo['userid'])) {
$state[] = 'private';
}
if (can_view_profile_albums($this->profile->userinfo['userid'])) {
$state[] = 'profile';
}
if (!$this->profile->prepared['myprofile']) {
if (!can_moderate(0, 'canmoderatepictures')) {
$sql = "AND album.visible > 0";
} else {
$sql = "AND (album.visible > 0 OR album.moderation > 0)";
}
} else {
$sql = "";
}
$hook_query_fields = $hook_query_joins = $hook_query_where = '';
($hook = vBulletinHook::fetch_hook('member_profileblock_album_query')) ? eval($hook) : false;
$albums = $this->registry->db->query_read_slave("\n\t\t\tSELECT album.*,\n\t\t\t\ta.attachmentid, album.moderation,\n\t\t\t\tfd.thumbnail_dateline, fd.thumbnail_width, fd.thumbnail_height, IF(fd.thumbnail_filesize > 0, 1, 0) AS hasthumbnail\n\t\t\t\t{$hook_query_fields}\n\t\t\tFROM " . TABLE_PREFIX . "album AS album\n\t\t\tLEFT JOIN " . TABLE_PREFIX . "attachment AS a ON (album.coverattachmentid = a.attachmentid)\n\t\t\tLEFT JOIN " . TABLE_PREFIX . "filedata AS fd ON (fd.filedataid = a.filedataid)\n\t\t\t{$hook_query_joins}\n\t\t\tWHERE\n\t\t\t\talbum.userid = " . $this->profile->userinfo['userid'] . "\n\t\t\t\t\tAND\n\t\t\t\talbum.state IN ('" . implode("', '", $state) . "')\n\t\t\t\t{$sql}\n\t\t\t\t{$hook_query_where}\n\t\t\tORDER BY album.lastpicturedate DESC\n\t\t\tLIMIT {$options['total']}\n\t\t");
$albumbits = '';
while ($album = $this->registry->db->fetch_array($albums)) {
$album['picturedate'] = vbdate($this->registry->options['dateformat'], $album['lastpicturedate'], true);
$album['picturetime'] = vbdate($this->registry->options['timeformat'], $album['lastpicturedate']);
$album['title_html'] = fetch_word_wrapped_string(fetch_censored_text($album['title']));
$album['coverdimensions'] = $album['thumbnail_width'] ? "width=\"{$album['thumbnail_width']}\" height=\"{$album['thumbnail_height']}\"" : '';
if ($album['moderation']) {
$album['moderatedcount'] = vb_number_format($album['moderation']);
$show['moderated'] = true;
} else {
$show['moderated'] = false;
}
$templater = vB_Template::create('memberinfo_albumbit');
$templater->register('album', $album);
$albumbits .= $templater->render();
}
$this->block_data['albumbits'] = $albumbits;
}
示例7: strlen
$have_image = false;
}
if ($have_image) {
if ($vbulletin->options['album_dataloc'] == 'db') {
$have_image = strlen($imageinfo['filedata']) > 0;
} else {
$have_image = file_exists(fetch_picture_fs_path($imageinfo, $vbulletin->GPC['thumb']));
}
}
if ($have_image) {
if ($imageinfo['albumstate'] != 'profile' and !($vbulletin->userinfo['permissions']['albumpermissions'] & $vbulletin->bf_ugp_albumpermissions['canviewalbum'])) {
// user's w/o viewing permission can only view profile category pictures directly
$have_image = false;
}
if ($imageinfo['albumstate'] == 'private') {
if (!can_view_private_albums($imageinfo['userid'])) {
// private album we can't see
$have_image = false;
}
}
}
($hook = vBulletinHook::fetch_hook('picture_haveimage')) ? eval($hook) : false;
if ($have_image) {
header('Cache-control: max-age=31536000');
header('Expires: ' . gmdate('D, d M Y H:i:s', TIMENOW + 31536000) . ' GMT');
header('Content-disposition: inline; filename=' . "user{$imageinfo['userid']}_pic{$imageinfo['pictureid']}_{$imageinfo['dateline']}" . ($vbulletin->GPC['thumb'] ? '_thumb' : '') . ".{$imageinfo['extension']}");
header('Content-transfer-encoding: binary');
if ($imageinfo['filesize']) {
header('Content-Length: ' . $imageinfo['filesize']);
}
header('Last-Modified: ' . gmdate('D, d M Y H:i:s', $imageinfo['dateline']) . ' GMT');
示例8: array
}
$navbits = array();
// checks for specific types
if ($vbulletin->GPC['albumid']) {
if (!($permissions['genericpermissions'] & $vbulletin->bf_ugp_genericpermissions['canviewmembers'])) {
print_no_permission();
}
$albuminfo = fetch_albuminfo($vbulletin->GPC['albumid']);
if (!$albuminfo) {
standard_error(fetch_error('invalidid', $vbphrase['album'], $vbulletin->options['contactuslink']));
}
if (!can_view_profile_section($albuminfo['userid'], 'albums')) {
// private album that we can not see
standard_error(fetch_error('invalidid', $vbphrase['album'], $vbulletin->options['contactuslink']));
}
if ($albuminfo['state'] == 'private' and !can_view_private_albums($albuminfo['userid'])) {
// private album that we can not see
standard_error(fetch_error('invalidid', $vbphrase['album'], $vbulletin->options['contactuslink']));
} else {
if ($albuminfo['state'] == 'profile' and !can_view_profile_albums($albuminfo['userid'])) {
// profile album that we can not see
standard_error(fetch_error('invalidid', $vbphrase['album'], $vbulletin->options['contactuslink']));
}
}
$pictureinfo = fetch_pictureinfo($vbulletin->GPC['attachmentid'], $vbulletin->GPC['albumid']);
$navbits = array(fetch_seo_url('member', $albuminfo) => construct_phrase($vbphrase['xs_profile'], $albuminfo['username']), 'album.php?' . $vbulletin->session->vars['sessionurl'] . "u={$albuminfo['userid']}" => $vbphrase['albums'], 'album.php?' . $vbulletin->session->vars['sessionurl'] . "albumid={$albuminfo['albumid']}" => $albuminfo['title_html']);
} else {
if ($vbulletin->GPC['groupid']) {
$group = fetch_socialgroupinfo($vbulletin->GPC['groupid']);
if (!$group) {
standard_error(fetch_error('invalidid', $vbphrase['social_group'], $vbulletin->options['contactuslink']));
示例9: do_get_albums
function do_get_albums()
{
global $vbulletin, $db, $show, $vbphrase, $foruminfo, $userinfo;
$vbulletin->input->clean_array_gpc('r', array('page' => TYPE_UINT, 'perpage' => TYPE_UINT));
$state = array('public');
if (can_view_private_albums($userinfo['userid'])) {
$state[] = 'private';
}
if (can_view_profile_albums($userinfo['userid'])) {
$state[] = 'profile';
}
$albumcount = $db->query_first("\n SELECT COUNT(*) AS total\n FROM " . TABLE_PREFIX . "album\n WHERE userid = {$userinfo['userid']}\n AND state IN ('" . implode("', '", $state) . "')\n ");
if ($vbulletin->GPC['page'] < 1) {
$vbulletin->GPC['page'] = 1;
}
$perpage = $vbulletin->GPC['perpage'];
if ($perpage <= 0) {
$perpage = 10;
}
$total_pages = max(ceil($albumcount['total'] / $perpage), 1);
// handle the case of 0 albums
$pagenumber = $vbulletin->GPC['page'] > $total_pages ? $total_pages : $vbulletin->GPC['page'];
$start = ($pagenumber - 1) * $perpage;
$hook_query_fields = $hook_query_joins = $hook_query_where = '';
($hook = vBulletinHook::fetch_hook('album_user_query')) ? eval($hook) : false;
// fetch data and prepare data
$albums = $db->query_read("\n SELECT album.*,\n attachment.attachmentid,\n IF(filedata.thumbnail_filesize > 0, 1, 0) AS hasthumbnail, filedata.thumbnail_dateline, filedata.thumbnail_width, filedata.thumbnail_height\n {$hook_query_fields}\n FROM " . TABLE_PREFIX . "album AS album\n LEFT JOIN " . TABLE_PREFIX . "attachment AS attachment ON (album.coverattachmentid = attachment.attachmentid)\n LEFT JOIN " . TABLE_PREFIX . "filedata AS filedata ON (attachment.filedataid = filedata.filedataid)\n {$hook_query_joins}\n WHERE\n album.userid = {$userinfo['userid']}\n AND\n album.state IN ('" . implode("', '", $state) . "')\n {$hook_query_where}\n ORDER BY album.lastpicturedate DESC\n LIMIT {$start}, {$perpage}\n ");
$out_albums = array();
while ($album = $db->fetch_array($albums)) {
$album['picturecount'] = vb_number_format($album['visible']);
$album['picturedate'] = vbdate($vbulletin->options['dateformat'], $album['lastpicturedate'], true);
$album['picturetime'] = vbdate($vbulletin->options['timeformat'], $album['lastpicturedate']);
$album['description_html'] = nl2br(fetch_word_wrapped_string(fetch_censored_text($album['description'])));
$album['title_html'] = fetch_word_wrapped_string(fetch_censored_text($album['title']));
$album['coverdimensions'] = $album['thumbnail_width'] ? "width=\"{$album['thumbnail_width']}\" height=\"{$album['thumbnail_height']}\"" : '';
if ($album['state'] == 'private') {
$show['personalalbum'] = true;
$albumtype = $vbphrase['private_album_paren'];
} else {
if ($album['state'] == 'profile') {
$show['personalalbum'] = true;
$albumtype = $vbphrase['profile_album_paren'];
} else {
$show['personalalbum'] = false;
}
}
if ($album['moderation'] and (can_moderate(0, 'canmoderatepictures') or $vbulletin->userinfo['userid'] == $album['userid'])) {
$show['moderated'] = true;
$album['moderatedcount'] = vb_number_format($album['moderation']);
} else {
$show['moderated'] = false;
}
$out = array('albumid' => $album['albumid'], 'title' => prepare_utf8_string(strip_tags(fetch_censored_text($album['title']))), 'description' => prepare_utf8_string(strip_tags(fetch_censored_text($album['description']))), 'private' => $album['state'] == 'private', 'photo_count' => strval($album['picturecount']));
if ($album['hasthumbnail']) {
$out['cover_url'] = fr_fix_url("attachment.php?{$session[sessionurl]}attachmentid={$album['attachmentid']}&thumb=1");
}
if ($album['lastpicturedate']) {
$out['update_date'] = prepare_utf8_string($album['picturedate'] . ' ' . $album['picturetime']);
} else {
$createdate = vbdate($vbulletin->options['dateformat'], $album['createdate'], true);
$createtime = vbdate($vbulletin->options['timeformat'], $album['createdate']);
$out['update_date'] = prepare_utf8_string($createdate . ' ' . $createtime);
}
$out_albums[] = $out;
}
$show['add_album_option'] = $userinfo['userid'] == $vbulletin->userinfo['userid'];
($hook = vBulletinHook::fetch_hook('album_user_complete')) ? eval($hook) : false;
$out = array('albums' => $out_albums, 'total_albums' => $albumcount['total'], 'can_add' => $userinfo['userid'] == $vbulletin->userinfo['userid']);
return $out;
}
示例10: state_sql
/**
* Builds conditions for the message query based on the user's permissions.
* @see fetch()
*
* @access protected
*
* @return string The built SQL
*/
function state_sql()
{
if (isset($this->state_sql)) {
return $this->state_sql;
}
// Build state conditions for query
$state = array('public');
if ($this->parent_id) {
if (can_view_private_albums($this->parent_id)) {
$state[] = 'private';
}
if (can_view_profile_albums($this->parent_id)) {
$state[] = 'profile';
}
}
$this->state_sql = "AND (album.state IN ('" . implode("','", $state) . "')";
if ($this->show_moderated and can_moderate(0, 'canmoderatepictures')) {
$this->state_sql .= 'AND (album.visible > 0 OR album.moderation > 0)';
} else {
$this->state_sql .= 'AND album.visible > 0';
}
$this->state_sql .= ')';
require_once DIR . '/includes/functions_user.php';
$privacy_requirement = fetch_user_relationship($this->parent_id, $this->registry->userinfo['userid']);
$this->state_sql .= " AND (profileblockprivacy.requirement <= " . intval($privacy_requirement) . " OR profileblockprivacy.requirement IS NULL)";
return $this->state_sql;
}
示例11: verify_attachment
/**
* Verify permissions of a single attachment
*
* @return bool
*/
public function verify_attachment()
{
if (!($this->registry->options['socnet'] & $this->registry->bf_misc_socnet['enable_albums']))
{
return false;
}
$hook_query_fields = $hook_query_joins = $hook_query_where = '';
($hook = vBulletinHook::fetch_hook('attachment_start')) ? eval($hook) : false;
$selectsql = array(
"album.state AS albumstate, album.albumid, album.userid AS albumuserid",
"pbp.requirement AS privacy_requirement",
);
$joinsql = array(
"LEFT JOIN " . TABLE_PREFIX . "album AS album ON (album.albumid = a.contentid)",
"LEFT JOIN " . TABLE_PREFIX . "profileblockprivacy AS pbp ON (pbp.userid = a.userid AND pbp.blockid = 'albums')",
);
if (!$this->verify_attachment_specific('vBForum_Album', $selectsql, $joinsql))
{
return false;
}
/* TODO
$this->browsinginfo = array(
'bloginfo' => array(
'blogid' => $this->attachmentinfo['blogid'],
),
'userinfo' => array(
'userid' => $this->attachmentinfo['userid'],
),
);
*/
require_once(DIR . '/includes/functions_user.php');
if ($this->attachmentinfo['contentid'] == 0)
{
// there may be a condition where certain moderators could benefit by seeing these, I just don't know of any conditions at present
if ($this->registry->userinfo['userid'] != $this->attachmentinfo['userid'])
{
return false;
}
}
else if (
!$this->attachmentinfo['albumid']
OR
$this->attachmentinfo['albumuserid'] != $this->attachmentinfo['userid']
OR
(
$this->attachmentinfo['state'] == 'moderation'
AND
$this->attachmentinfo['userid'] != $this->registry->userinfo['userid']
AND
!can_moderate(0, 'canmoderatepictures')
AND
!can_moderate(0, 'caneditalbumpicture')
)
OR
(
$this->attachmentinfo['privacy_requirement']
AND
fetch_user_relationship($this->attachmentinfo['userid'], $this->registry->userinfo['userid']) < $this->attachmentinfo['privacy_requirement']
)
OR
(
$this->attachmentinfo['albumstate'] != 'profile'
AND
!($this->registry->userinfo['permissions']['albumpermissions'] & $this->registry->bf_ugp_albumpermissions['canviewalbum'])
)
OR
(
$this->attachmentinfo['albumstate'] == 'private'
AND
!can_view_private_albums($this->attachmentinfo['userid'])
)
)
{
// echo clear.gif, not permissions error. This may only be needed for 'albumstate' == 'profile'
return 0;
}
return true;
}