Exemple #1
0
	/**
	 * Verifies permissions to attach content to entries
	 *
	 * @return	boolean
	 */
	public function verify_permissions()
	{
		global $vbulletin;

		if (!isset($this->contentid) and !vB::$vbulletin->GPC_exists['values'])
		{
			vB::$vbulletin->input->clean_array_gpc('r', array(
				'f' => vB_Input::TYPE_UINT,
				'attachmentid' => vB_Input::TYPE_UINT
			));
		}

		if (vB::$vbulletin->GPC_exists['values'] and isset(vB::$vbulletin->GPC['values']['f']))
		{
			$this->contentid = vB::$vbulletin->GPC['values']['f'];
		}

		if (isset($this->contentid))
		{

			return vBCMS_Permissions::canDownload($this->contentid);
		}

		if (vB::$vbulletin->GPC_exists['attachmentid'] AND $record = vB::$vbulletin->db->query_first('SELECT contentid FROM ' .
			TABLE_PREFIX . "attachment WHERE attachmentid = " . vB::$vbulletin->GPC['attachmentid']))
		{
			$this->contentid = $record['contentid'];
			return vBCMS_Permissions::canEdit($this->contentid);
		}
	}