Addons:Request

From GExtension Wiki
Revision as of 09:17, 21 May 2017 by Ibot3 (talk | contribs) (Created page with "== General and Name == 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...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

General and Name

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>');