Exemplo n.º 1
0
 /**
  * Verifies permissions to attach content to posts
  *
  * @param	object	vB_Upload
  * @param	array		Information about uploaded attachment
  *
  * @return	void
  */
 protected function process_upload($upload, $attachment, $imageonly = false)
 {
     if (!$this->foruminfo['allowposting']) {
         $error = $vbphrase['this_forum_is_not_accepting_new_attachments'];
         $errors[] = array('filename' => is_array($attachment) ? $attachment['name'] : $attachment, 'error' => $error);
     } else {
         if ($attachmentid = parent::process_upload($upload, $attachment, $imageonly) and $this->registry->userinfo['userid'] != $this->postinfo['userid'] and can_moderate($this->threadinfo['forumid'], 'caneditposts')) {
             $this->postinfo['attachmentid'] = $attachmentid;
             $this->postinfo['forumid'] = $foruminfo['forumid'];
             require_once DIR . '/includes/functions_log_error.php';
             log_moderator_action($this->postinfo, 'attachment_uploaded');
         }
         return $attachmentid;
     }
 }
Exemplo n.º 2
0
	/**
	 * Verifies permissions to attach content to posts
	 *
	 * @param	object	vB_Upload
	 * @param	array		Information about uploaded attachment
	 *
	 * @return	integer
	 */
	protected function process_upload($upload, $attachment, $imageonly = false)
	{
		$attachmentid = parent::process_upload($upload, $attachment, $imageonly);

		if (!vB::$vbulletin->GPC['values']['f'])
		{
			vB::$vbulletin->input->clean_array_gpc('r', array(
				'values' => vB_Input::TYPE_ARRAY
			));

		}

		if ($attachmentid AND vB::$vbulletin->GPC_exists['values'] AND isset(vB::$vbulletin->GPC['values']['f']))
		{
			$this->contentid = vB::$vbulletin->GPC['values']['f'];
			vB::$vbulletin->db->query_write("UPDATE " . TABLE_PREFIX . "attachment SET contentid = " . $this->contentid	. " WHERE attachmentid = $attachmentid" );
		}
		return $attachmentid;
	}
Exemplo n.º 3
0
	/**
	* Verifies permissions to attach content to posts
	*
	* @param	object	vB_Upload
	* @param	array		Information about uploaded attachment
	*
	* @return	integer
	*/
	protected function process_upload($upload, $attachment, $imageonly = false)
	{
		if (
			($attachmentid = parent::process_upload($upload, $attachment, $imageonly))
				AND
			$this->registry->userinfo['userid'] != $this->bloginfo['userid']
				AND
			can_moderate_blog('caneditcomments')
		)
		{
			$this->bloginfo['attachmentid'] = $attachmentid;
			require_once(DIR . '/includes/blog_functions_log_error.php');
			log_moderator_action($this->bloginfo, 'attachment_uploaded');
		}

		return $attachmentid;
	}
Exemplo n.º 4
0
	/**
	* Verifies permissions to attach content to albums
	*
	* @param	object	vB_Upload
	* @param	array		Information about uploaded attachment
	*
	* @return	integer
	*/
	protected function process_upload($upload, $attachment, $imageonly = false)
	{
		// third argument forces thumbnails on for social groups
		return parent::process_upload($upload, $attachment, $imageonly);
	}
Exemplo n.º 5
0
	/**
	* Verifies permissions to attach content to albums
	*
	* @param	object	vB_Upload
	* @param	array		Information about uploaded attachment
	*
	* @return	integer
	*/
	protected function process_upload($upload, $attachment, $imageonly = false)
	{
		$exists = $this->registry->db->query_first("
			SELECT COUNT(*) AS count
			FROM " . TABLE_PREFIX . "attachment AS a
			WHERE
				a.contentid = 0
					AND
				a.posthash = '" . $this->registry->db->escape_string($this->values['posthash']) . "'
		");
		$existing = $existing['count'];

		$this->contentid = $this->values['albumid'];
		$this->fetch_attachcount();
		$this->contentid = 0;

		// these values are negative (non-overage), so we need to flip them around for a "remaining" value
		if (isset($this->totalpics_overage) AND $this->totalpics_overage >= 0)
		{
			standard_error(fetch_error('upload_album_pics_countfull', vb_number_format(-1 * $this->albumpics_overage)));
		}

		$moderatedpictures = (
			(
				$this->registry->options['albums_pictures_moderation']
					OR
				!($this->registry->userinfo['permissions']['albumpermissions'] & $this->registry->bf_ugp_albumpermissions['picturefollowforummoderation'])
			)
				AND
			!can_moderate(0, 'canmoderatepictures')
		);

		$this->uploadcount++;

		if (!($attachmentid = parent::process_upload($upload, $attachment, $imageonly)))
		{
			$this->uploadcount--;
			return false;
		}
		// add to updated list
		if (
			can_moderate(0, 'canmoderatepictures')
				OR
			(
				!$this->registry->options['albums_pictures_moderation']
		 			AND
		 		$this->registry->userinfo['permissions']['albumpermissions'] & $this->registry->bf_ugp_albumpermissions['picturefollowforummoderation']
			)
		)
		{
			exec_album_updated($this->registry->userinfo, $this->albuminfo);
		}

		if (!$moderatedpictures AND !$this->albuminfo['coverattachmentid'])
		{
			$this->albuminfo['coverattachmentid'] = $attachmentid;
			// no cover -> set cover to the first pic uploaded
			$this->registry->db->query_write("
				UPDATE " . TABLE_PREFIX . "album
				SET
					coverattachmentid = $attachmentid
				WHERE
					albumid = {$this->albuminfo['albumid']}
			");
		}

		return $attachmentid;
	}