Addons:Request

From GExtension Wiki
Jump to navigation Jump to search

The request environment can be used to provide pages that can be called for example in AJAX requests. It's a clean site, but with all variables, classes and functions that GExtension has. The request file is then available under request.php?t=<rawname>.

If a request page is related to a page, the file should have the same name.

Security Check

To verify that the file was included by GExtension, it's required to include the following code at the beginning of the file:

<?php 
	if(!isset($G_REQUEST)){
		die(json_encode(array("error" => "authentification failed")));
	}
?>

No Login

By default, using a request page is only possible when logged in. To make a file public, you need to run the following function once (may put it in the install.php):

NoAuthFiles::Add('request', '<rawname>');