	private function readData()
	{
		if (isset($this->tid) && $this->tid != - 1) {
			
			if ($this->userinfo['customerid'] > 0) {
				$_ticket_stmt = Database::prepare('
					SELECT * FROM `' . TABLE_PANEL_TICKETS . '` WHERE `id` = :tid AND `customerid` = :cid');
				$tdata = array(
					'tid' => $this->tid,
					'cid' => $this->userinfo['customerid']
				);
			} else {
				$_ticket_stmt = Database::prepare('
					SELECT * FROM `' . TABLE_PANEL_TICKETS . '` WHERE `id` = :tid' . ($this->userinfo['customers_see_all'] ? '' : ' AND `adminid` = :adminid'));
				$tdata = array(
					'tid' => $this->tid
				);
				if ($this->userinfo['customers_see_all'] != '1') {
					$tdata['adminid'] = $this->userinfo['adminid'];
				}
			}
			$_ticket = Database::pexecute_first($_ticket_stmt, $tdata);
			
			if ($_ticket == false) {
				throw new Exception("Invalid ticket id");
			}
			
			$this->Set('customer', $_ticket['customerid'], true, false);
			$this->Set('admin', $_ticket['adminid'], true, false);
			$this->Set('subject', $_ticket['subject'], true, false);
			$this->Set('category', $_ticket['category'], true, false);
			$this->Set('priority', $_ticket['priority'], true, false);
			$this->Set('message', $_ticket['message'], true, false);
			$this->Set('dt', $_ticket['dt'], true, false);
			$this->Set('lastchange', $_ticket['lastchange'], true, false);
			$this->Set('ip', $_ticket['ip'], true, false);
			$this->Set('status', $_ticket['status'], true, false);
			$this->Set('lastreplier', $_ticket['lastreplier'], true, false);
			$this->Set('by', $_ticket['by'], true, false);
			$this->Set('answerto', $_ticket['answerto'], true, false);
			$this->Set('archived', $_ticket['archived'], true, false);
		}
The product specifies permissions for a security-critical resource in a way that allows that resource to be read or modified by unintended actors.