function check_overage() { require_once DIR . '/includes/functions_album.php'; if ($this->userinfo['permissions']['albummaxpics']) { $overage = fetch_count_overage($this->userinfo['userid'], $this->userinfo['permissions']['albummaxpics'], 1); if ($overage > 0) { $this->set_error('upload_total_album_pics_countfull', vb_number_format($overage)); return false; } } if ($this->userinfo['permissions']['albummaxsize']) { $overage = fetch_size_overage($this->userinfo['userid'], $this->userinfo['permissions']['albummaxsize'], $this->upload['filesize']); if ($overage > 0) { $this->set_error('upload_album_sizefull', vb_number_format($overage, 0, true)); return false; } } return true; }
} else { $show['moderation'] = false; $have_visible = true; } ($hook = vBulletinHook::fetch_hook('album_album_picturebit')) ? eval($hook) : false; if ($show['add_group_form'] and $picture['state'] == 'visible') { eval('$picturebits .= "' . fetch_template('album_picturebit_checkbox') . '";'); } else { eval('$picturebits .= "' . fetch_template('album_picturebit') . '";'); } } $pagenav = construct_page_nav($pagenumber, $perpage, $totalpictures, 'album.php?' . $vbulletin->session->vars['sessionurl'] . "albumid={$albuminfo['albumid']}", ''); $show['add_group_form'] = ($have_visible and $show['add_group_form'] and $picturebits) ? true : false; $show['add_group_row'] = ($have_visible and $show['add_group_row'] and $picturebits) ? true : false; $show['edit_album_option'] = ($userinfo['userid'] == $vbulletin->userinfo['userid'] or can_moderate(0, 'caneditalbumpicture')); $show['add_picture_option'] = ($userinfo['userid'] == $vbulletin->userinfo['userid'] and fetch_count_overage($userinfo['userid'], $vbulletin->userinfo['permissions']['albummaxpics']) <= 0 and (!$vbulletin->options['album_maxpicsperalbum'] or $totalpictures - $vbulletin->options['album_maxpicsperalbum'] < 0)); if ($albuminfo['state'] == 'private') { $show['personalalbum'] = true; $albumtype = $vbphrase['private_album_paren']; } else { if ($albuminfo['state'] == 'profile') { $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') . '");');
/** * Verifies permissions to attach content to albums * * @return boolean */ public function verify_permissions() { global $show; $this->values['albumid'] = intval($this->values['albumid']); if (!($this->albuminfo = fetch_albuminfo($this->values['albumid']))) { return false; } if ($this->albuminfo['userid'] != $this->registry->userinfo['userid']) { return false; } if ($this->registry->userinfo['permissions']['albummaxpics']) { // assume we are uploading 1 pic (at least) $this->totalpics_overage = fetch_count_overage($this->registry->userinfo['userid'], $this->registry->userinfo['permissions']['albummaxpics'], 0); if ($this->totalpics_overage >= 0) { standard_error(fetch_error('upload_total_album_pics_countfull', vb_number_format($this->totalpics_overage))); } } if ($this->registry->options['album_maxpicsperalbum']) { $this->albumpics_overage = ($this->albuminfo['visible'] + $this->albuminfo['moderation'] - $this->registry->options['album_maxpicsperalbum']); if ($this->albumpics_overage >= 0) { standard_error(fetch_error('upload_album_pics_countfull', vb_number_format($this->albumpics_overage))); } } if ($this->registry->userinfo['permissions']['albummaxsize']) { // we don't know the size of the image yet, so ignore it and error if we have 0 bytes (or less) remaining $size_overage = fetch_size_overage($this->registry->userinfo['userid'], $this->registry->userinfo['permissions']['albummaxsize'], 0); if ($size_overage >= 0) { standard_error(fetch_error('upload_album_sizefull', vb_number_format($size_overage, 0, true))); } } return true; }
function do_get_photos() { global $vbulletin, $db, $show, $vbphrase, $foruminfo, $userinfo, $albuminfo, $session, $contenttypeid; if (empty($albuminfo)) { standard_error(fetch_error('invalidid', $vbphrase['album'], $vbulletin->options['contactuslink'])); } if ($vbulletin->GPC['addgroup'] and $albuminfo['userid'] != $vbulletin->userinfo['userid']) { print_no_permission(); } ($hook = vBulletinHook::fetch_hook('album_album')) ? eval($hook) : false; $perpage = 999999; $vbulletin->GPC['pagenumber'] = 1; $input_pagenumber = $vbulletin->GPC['pagenumber']; if (can_moderate(0, 'canmoderatepictures') or $albuminfo['userid'] == $vbulletin->userinfo['userid']) { $totalpictures = $albuminfo['visible'] + $albuminfo['moderation']; } else { $totalpictures = $albuminfo['visible']; } $total_pages = max(ceil($totalpictures / $perpage), 1); // 0 pictures still needs an empty page $pagenumber = $vbulletin->GPC['pagenumber'] > $total_pages ? $total_pages : $vbulletin->GPC['pagenumber']; $start = ($pagenumber - 1) * $perpage; $hook_query_fields = $hook_query_joins = $hook_query_where = ''; ($hook = vBulletinHook::fetch_hook('album_album_query')) ? eval($hook) : false; $pictures = $db->query_read("\n SELECT\n a.attachmentid, a.userid, a.caption, a.dateline, a.state,\n fd.filesize, IF(fd.thumbnail_filesize > 0, 1, 0) AS hasthumbnail, fd.thumbnail_dateline, fd.thumbnail_width, fd.thumbnail_height\n {$hook_query_fields}\n FROM " . TABLE_PREFIX . "attachment AS a\n INNER JOIN " . TABLE_PREFIX . "filedata AS fd ON (fd.filedataid = a.filedataid)\n {$hook_query_joins}\n WHERE\n a.contentid = {$albuminfo['albumid']}\n AND\n a.contenttypeid = " . intval($contenttypeid) . "\n " . ((!can_moderate(0, 'canmoderatepictures') and $albuminfo['userid'] != $vbulletin->userinfo['userid']) ? "AND a.state = 'visible'" : "") . "\n {$hook_query_where}\n ORDER BY a.dateline DESC\n LIMIT {$start}, {$perpage}\n "); // work out the effective picturebit height/width including any borders and paddings; the +4 works around an IE float issue $picturebit_height = $vbulletin->options['album_thumbsize'] + (($usercss ? 0 : $stylevar['cellspacing']) + $stylevar['cellpadding']) * 2 + 4; $picturebit_width = $vbulletin->options['album_thumbsize'] + (($usercss ? 0 : $stylevar['cellspacing']) + $stylevar['cellpadding']) * 2; $out_photos = array(); $picnum = 0; while ($picture = $db->fetch_array($pictures)) { $picture = prepare_pictureinfo_thumb($picture, $albuminfo); if ($picnum % $vbulletin->options['album_pictures_perpage'] == 0) { $show['page_anchor'] = true; $page_anchor = $picnum / $vbulletin->options['album_pictures_perpage'] + 1; } else { $show['page_anchor'] = false; } $picnum++; if ($picture['state'] != 'visible') { continue; } ($hook = vBulletinHook::fetch_hook('album_album_picturebit')) ? eval($hook) : false; $photo_url = "attachment.php?{$session[sessionurl]}attachmentid={$picture['attachmentid']}"; $out_photos[] = array('photoid' => $picture['attachmentid'], 'userid' => $picture['userid'], 'caption' => prepare_utf8_string(strip_tags(fetch_censored_text($picture['caption']))), 'photo_date' => prepare_utf8_string($picture['date'] . ' ' . $picture['time']), 'photo_url' => fr_fix_url($photo_url), 'thumb_url' => fr_fix_url($photo_url . '&thumb=1')); } $show['add_picture_option'] = ($userinfo['userid'] == $vbulletin->userinfo['userid'] and fetch_count_overage($userinfo['userid'], $albuminfo[albumid], $vbulletin->userinfo['permissions']['albummaxpics']) <= 0 and (!$vbulletin->options['album_maxpicsperalbum'] or $totalpictures - $vbulletin->options['album_maxpicsperalbum'] < 0)); if ($albuminfo['state'] == 'private') { $show['personalalbum'] = true; $albumtype = $vbphrase['private_album_paren']; } else { if ($albuminfo['state'] == 'profile') { $show['personalalbum'] = true; $albumtype = $vbphrase['profile_album_paren']; } } $out = array('photos' => $out_photos, 'total_photos' => $totalpictures, 'can_add_photo' => $show['add_picture_option'] ? true : false); return $out; }
$templater = vB_Template::create('album_picturebit'); } $templater->register('albuminfo', $albuminfo); $templater->register('picture', $picture); $templater->register('usercss', $usercss); $picturebits .= $templater->render(); } $pagenav = construct_page_nav($pagenumber, $perpage, $totalpictures, 'album.php?' . $vbulletin->session->vars['sessionurl'] . "albumid=$albuminfo[albumid]", ''); $show['edit_album_option'] = ($userinfo['userid'] == $vbulletin->userinfo['userid'] OR can_moderate(0, 'caneditalbumpicture')); $show['add_picture_option'] = ( $userinfo['userid'] == $vbulletin->userinfo['userid'] AND fetch_count_overage($userinfo['userid'], $albuminfo[albumid], $vbulletin->userinfo['permissions']['albummaxpics']) <= 0 AND ( !$vbulletin->options['album_maxpicsperalbum'] OR $totalpictures - $vbulletin->options['album_maxpicsperalbum'] < 0 ) ); if ($albuminfo['state'] == 'private') { $show['personalalbum'] = true; $albumtype = $vbphrase['private_album_paren']; } else if ($albuminfo['state'] == 'profile') {