if ($userinfo['permissions']['albummaxpics']) { // assume we are uploading 1 pic (at least) $totalpics_overage = fetch_count_overage($userinfo['userid'], $userinfo['permissions']['albummaxpics'], 0); if ($totalpics_overage >= 0) { standard_error(fetch_error('upload_total_album_pics_countfull', vb_number_format($totalpics_overage))); } } if ($vbulletin->options['album_maxpicsperalbum']) { $albumpics_overage = $albuminfo['visible'] + $albuminfo['moderation'] - $vbulletin->options['album_maxpicsperalbum']; if ($albumpics_overage >= 0) { standard_error(fetch_error('upload_album_pics_countfull', vb_number_format($albumpics_overage))); } } if ($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($userinfo['userid'], $userinfo['permissions']['albummaxsize'], 0); if ($size_overage >= 0) { standard_error(fetch_error('upload_album_sizefull', vb_number_format($size_overage, 0, true))); } } // these values are negative (non-overage), so we need to flip them around for a "remaining" value $pics_remain = null; if (isset($totalpics_overage)) { $pics_remain = -1 * $totalpics_overage; } if (isset($albumpics_overage)) { $temp_remain = -1 * $albumpics_overage; if ($pics_remain === null or $temp_remain < $pics_remain) { $pics_remain = $temp_remain; } }
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; }
/** * 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; }