Sends a header

@access public
@param string $message
@param integer $code
768210
public function sendHeader($message, $code = null)
    {
        if (!($this->request instanceof WebRequest)) {
            return;
        }
        
        if ($code !== null) {
            header($message, true, $code);
        } else {
            header($message);
        }
    }
448740
protected function respondWithError(
        $message = 'Bad Request',
        $code = SymfonyResponse::HTTP_BAD_REQUEST,
        array $headers = []
    ) {
        return abort($code, $message, $headers);
    }
89810
public static function status(
    /*int*/ $code,
    /*string*/ $message = null
  ) {
    // General header as response.
    $header =
      @intval($code) .
      (!$message ? '' : ' ' . $message);

    // Send status for both CGI and non-CGI web servers.
    header(self::getProtocol() . ' ' . $header);
    header('Status: ' . $header);
  }
52198
public static function start_header(
		int $code=200, int $cache=0, array $headers=[]
	) {
		$msg = 'OK';
		extract(self::get_header_string($code));

		$proto = isset($_SERVER['SERVER_PROTOCOL'])
			? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.1';
		static::header("$proto $code $msg");
		if ($cache) {
			$cache = intval($cache);
			$expire = time() + $cache;
			static::header("Expires: " .
				gmdate("D, d M Y H:i:s", $expire)." GMT");
			static::header("Cache-Control: must-revalidate");
		} else {
			static::header("Expires: Mon, 27 Jul 1996 07:00:00 GMT");
			static::header(
				"Cache-Control: no-store, no-cache, must-revalidate");
			static::header("Cache-Control: post-check=0, pre-check=0");
			static::header("Pragma: no-cache");
		}
		static::header("Last-Modified: " .
			gmdate("D, d M Y H:i:s")." GMT");
		static::header("X-Powered-By: Zap!", true);

		if (!$headers)
			return;
		foreach ($headers as $header)
			static::header($header);
	}
860459
public function log($message, $code = self::INFO) {
		$this->adapter->log($code, $message);
	}
543713
public function redirect($url, $code = 301)
    {
        $this->setStatusCode($code);
        $this->addHeader(HttpProtocol::HEADER_LOCATION, $url);
    }
927704
protected function error($code)
    {
        $this->sendFrame('c' . json_encode([$code, isset($this->errors[$code]) ? $this->errors[$code] : null]));
    }
1201562
protected function sendResponseHeadersToClient(WebRequest $request, $code, $message)
    {
        $headers = [
            "Date"       => gmdate("D, d M Y H:i:s T"),
            "Connection" => "close"
        ];
        
        $bytes = $this->sendToClient($request->getVersion() . " {$code} {$message}\r\n");
        foreach($headers as $header => $value) {
            $bytes += $this->sendToClient("{$header}: {$value}\r\n");
        }
        $bytes += $this->sendToClient("\r\n");
        
        return $bytes;
    }
579335
public function send()
    {
        header(
            sprintf(
                'HTTP/1.1 %s %s',
                $this->statusCode,
                self::codeToReason($this->statusCode)
            )
        );
        foreach ($this->headers as $k => $v) {
            header(
                sprintf('%s: %s', $k, $v)
            );
        }
        echo $this->body;
    }
1133827
protected function SendmailSend($header, $body) {
    if ($this->Sender != '') {
      $sendmail = sprintf("%s -oi -f%s -t", escapeshellcmd($this->Sendmail), escapeshellarg($this->Sender));
    } else {
      $sendmail = sprintf("%s -oi -t", escapeshellcmd($this->Sendmail));
    }
    if ($this->SingleTo === true) {
      foreach ($this->SingleToArray as $key => $val) {
        if(!@$mail = popen($sendmail, 'w')) {
          throw new phpmailerException($this->Lang('execute') . $this->Sendmail, self::STOP_CRITICAL);
        }
        fputs($mail, "To: " . $val . "\n");
        fputs($mail, $header);
        fputs($mail, $body);
        $result = pclose($mail);
        // implement call back function if it exists
        $isSent = ($result == 0) ? 1 : 0;
        $this->doCallback($isSent, $val, $this->cc, $this->bcc, $this->Subject, $body);
        if($result != 0) {
          throw new phpmailerException($this->Lang('execute') . $this->Sendmail, self::STOP_CRITICAL);
        }
      }
    } else {
      if(!@$mail = popen($sendmail, 'w')) {
        throw new phpmailerException($this->Lang('execute') . $this->Sendmail, self::STOP_CRITICAL);
      }
      fputs($mail, $header);
      fputs($mail, $body);
      $result = pclose($mail);
      // implement call back function if it exists
      $isSent = ($result == 0) ? 1 : 0;
      $this->doCallback($isSent, $this->to, $this->cc, $this->bcc, $this->Subject, $body);
      if($result != 0) {
        throw new phpmailerException($this->Lang('execute') . $this->Sendmail, self::STOP_CRITICAL);
      }
    }
    return true;
  }
372850
public function sendError($code = 204, $vars = null, $headers = [])
    {
        $languageKey = $code . '_' . error_code_string($code);

        $error = [
            'code'    => $code,
            'title'   => language()->getLine($languageKey . '_TITLE'),
            'message' => language()->getLine($languageKey . '_MESSAGE'),
        ];

        $this->statusCode = $code;
        $this->reasonPhrase = $error[ 'title' ];

        if (is_string($vars)) {
            $vars = ['message' => $vars];
        } elseif (is_array($vars) and empty($vars[ 'message' ])) {
            $vars[ 'message' ] = $error[ 'message' ];
        }

        if (isset($vars[ 'message' ])) {
            $error[ 'message' ] = $vars[ 'message' ];
        }

        if (is_ajax() or $this->mimeType !== 'text/html') {
            $this->statusCode = $code;
            $this->reasonPhrase = $error[ 'title' ];
            $this->send($vars);

            exit(EXIT_ERROR);
        }

        $this->sendHeaders($headers);

        if (services()->has('presenter')) {
            presenter()->initialize();

            if (presenter()->theme) {
                presenter()->theme->load();
            }

            $vars = presenter()->getArrayCopy();
            extract($vars);
        }

        extract($error);

        ob_start();
        include $this->getFilePath('error-code');
        $htmlOutput = ob_get_contents();
        ob_end_clean();

        if (services()->has('presenter')) {
            $htmlOutput = presenter()->assets->parseSourceCode($htmlOutput);
        }

        echo $htmlOutput;
        exit(EXIT_ERROR);
    }
185452
private function SendMessage($message)
    {
        $this->signal_data->message = $message;
        
        $this->Send(
            \Peg\Lib\Signals\Type\Definitions::IMPORT_MESSAGE,
            $this->signal_data
        );
    }
144706
public function shutdown($message = null, $code = null)
    {
        if (!is_null($message)) {
            $this->shutdownMessage = $message;
        }
        if (!is_null($code)) {
            $this->shutdownCode = $code;
        }
        $this->shutdown = true;
        return true;
    }
5878
private function _setError($code, $message = "")
    {
        if (isset(self::$_errors[$code])) {
            $this->_errorCode = $code;
            $this->_errorMessage = self::$_errors[$code];
        } else {
            $this->_errorCode = PLUPLOAD_UNKNOWN_ERR;
            $this->_errorMessage = self::$_errors[PLUPLOAD_UNKNOWN_ERR];
        }
        if ($message) {
            $this->_errorMessage = $message;
        }
        return $this;
    }
561533
public function send($code = null, array $headers = null, $compress = false)
    {
        if ($code !== null) {
            $this->withStatus($code);
        }
        if ($headers !== null) {
            $this->setHeaders($headers);
        }

        $body = $this->body;
        $this->headers['Content-Length'] = strlen($body);

        if ($compress === true) {
            $encoding = '';
            if (preg_match('/ *gzip *,?/', $this->headers['accept-encoding'])) {
                $encoding = 'gzip';
            } elseif (preg_match('/ *deflate *,?/', $this->headers['accept-encoding'])) {
                $encoding = 'deflate';
            }
            (isset($encoding)) ? $this->headers['Content-Encoding'] = $encoding : null;
            $body = static::encodeBody($body, $encoding);
        }
        $this->sendHeaders();
        echo $body;
    }
994767
public function sendResult($code, $mime, $message)
    {
        $this->sendHeader('HTTP/1.0 ' . $code);
        $this->sendHeader('Content-Type: ' . $mime);
        $this->sendResponse($message);
    }
965809
public function send($message)
    {
        try {
            $code = 200;
            $this->sendEvent($this->targetServiceName, $message);
            $message = 'Event has been sent';
        } catch (\Exception $exception) {
            $message = $exception->getMessage();
            $code = $exception->getCode();
        }

        return new Response(
            json_encode(['message' => $message]),
            (!empty($code)) ? $code : 500
        );
    }