/**
  * Constructor
  * 
  * @param array $config
  */
 public function __construct(array $config = [])
 {
     parent::__construct($config);
     $request = Services::request(null, true);
     $this->json['request_uri'] = (string) $request->uri;
     Hooks::on('post_controller', [$this, 'sendLogs'], HOOKS_PRIORITY_HIGH);
 }
								</td>
							</tr>
						<?php 
    }
    ?>
						</tbody>
					</table>
				<?php 
}
?>
			</div>

			<!-- Request -->
			<div class="content" id="request">
				<?php 
$request = \CodeIgniter\Services::request(null, true);
?>

				<table>
					<tbody>
						<tr>
							<td style="width: 10em">Path</td>
							<td><?php 
echo $request->uri;
?>
</td>
						</tr>
						<tr>
							<td>HTTP Method</td>
							<td><?php 
echo $request->getMethod(true);
Example #3
0
 /**
  * Used to force a page to be accessed in via HTTPS.
  * Uses a standard redirect, plus will set the HSTS header
  * for modern browsers that support, which gives best
  * protection against man-in-the-middle attacks.
  *
  * @see https://en.wikipedia.org/wiki/HTTP_Strict_Transport_Security
  *
  * @param int $duration How long should the SSL header be set for? (in seconds)
  *                      Defaults to 1 year.
  * @param RequestInterface $request
  * @param ResponseInterface $response
  */
 function force_https(int $duration = 31536000, RequestInterface $request = null, ResponseInterface $response = null)
 {
     if (is_null($request)) {
         $request = Services::request(null, true);
     }
     if (is_null($response)) {
         $response = Services::response(null, true);
     }
     if ($request->isSecure()) {
         return;
     }
     // If the session library is loaded, we should regenerate
     // the session ID for safety sake.
     if (class_exists('Session', false)) {
         Services::session(null, true)->regenerate();
     }
     $uri = $request->uri;
     $uri->setScheme('https');
     $uri = \CodeIgniter\HTTP\URI::createURIString($uri->getScheme(), $uri->getAuthority(true), $uri->getPath(), $uri->getQuery(), $uri->getFragment());
     // Set an HSTS header
     $response->setHeader('Strict-Transport-Security', 'max-age=' . $duration);
     $response->redirect($uri);
     exit;
 }
Example #4
0
 /**
  * Get our Request object, (either IncomingRequest or CLIRequest)
  * and set the server protocol based on the information provided
  * by the server.
  */
 protected function getRequestObject()
 {
     if (is_cli()) {
         $this->request = Services::clirequest($this->config);
     } else {
         $this->request = Services::request($this->config);
         $this->request->setProtocolVersion($_SERVER['SERVER_PROTOCOL']);
     }
 }
Example #5
0
 /**
  * URL String
  *
  * Returns the URI segments.
  *
  * @return	string
  */
 function uri_string() : string
 {
     return \CodeIgniter\Services::request()->uri->getPath();
 }