예제 #1
0
	/**
	 * Creates a new PackageUpdateAuthForm object.
	 * 
	 * @param	wcf\system\package\PackageUpdateAuthorizationRequiredException		$exception
	 */
	public function __construct(PackageUpdateAuthorizationRequiredException $exception = null) {
		$this->exception = $exception;
		if ($this->exception !== null) {
			$this->packageUpdateServerID = $this->exception->getPackageUpdateServerID();
			$this->url = $this->exception->getURL();
			$this->header = $this->exception->getResponseHeader();
			
			// get message
			$this->message = $this->exception->getResponseContent();
			
			// find out response charset
			if (isset($this->header['Content-type']) && preg_match('/charset=([a-z0-9\-]+)/i', $this->header['Content-type'], $match)) {
				$charset = strtoupper($match[1]);
				if ($charset != 'UTF-8') $this->message = @StringUtil::convertEncoding($charset, 'UTF-8', $this->message);
			}
			
			// format message
			$this->message = nl2br(preg_replace("/\n{3,}/", "\n\n", StringUtil::unifyNewlines(StringUtil::trim(strip_tags($this->message)))));
		}
		
		parent::__construct();
	}