Add CDN and add API class
This commit is contained in:
parent
c85c329020
commit
986791fea1
|
|
@ -0,0 +1,29 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
|
||||
Platinus API
|
||||
|
||||
*/
|
||||
|
||||
namespace Platinus;
|
||||
|
||||
class API {
|
||||
function __construct() {
|
||||
if(http_response_code() == 404){
|
||||
API::InvokeError(403, "Unauthorized");
|
||||
}
|
||||
}
|
||||
|
||||
function InvokeError($errorCode, $message) {
|
||||
http_response_code($errorCode);
|
||||
header("Content-Type: application/json");
|
||||
exit(API::PrettyJSONEncode(["error"=>"$message"]));
|
||||
}
|
||||
|
||||
function PrettyJSONEncode($array){
|
||||
return json_encode($array, JSON_PRETTY_PRINT);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
@ -6,13 +6,11 @@ Platinus Backend Autoloader
|
|||
|
||||
*/
|
||||
|
||||
$webAssemblies = $_SERVER["DOCUMENT_ROOT"] . "/../WebAssemblies/";
|
||||
|
||||
function reqMod($mod) {
|
||||
global $webAssemblies;
|
||||
require $webAssemblies . $mod;
|
||||
require $mod;
|
||||
}
|
||||
|
||||
reqMod("Web.php");
|
||||
reqMod("API.php");
|
||||
|
||||
?>
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
|
||||
Platinus CDN Api
|
||||
|
||||
*/
|
||||
|
||||
require $_SERVER["DOCUMENT_ROOT"] . "/../../../WebAssemblies/loader.php";
|
||||
|
||||
$page = new Platinus\API();
|
||||
|
||||
$page->InvokeError(403, "Unauthorized");
|
||||
?>
|
||||
|
|
@ -6,7 +6,7 @@ Platinus Home Page
|
|||
|
||||
*/
|
||||
|
||||
require $_SERVER["DOCUMENT_ROOT"] . "/../WebAssemblies/loader.php";
|
||||
require $_SERVER["DOCUMENT_ROOT"] . "/../../WebAssemblies/loader.php";
|
||||
|
||||
$page = new Platinus\Web();
|
||||
|
||||
|
|
@ -18,7 +18,7 @@ $headers = $page->buildHeaders();
|
|||
|
||||
?>
|
||||
<h1>Platinus</h1>
|
||||
<h3>Yeah</h3>
|
||||
<h3>Simple home page</h3>
|
||||
<?php
|
||||
|
||||
$page->buildPage($headers);
|
||||
Loading…
Reference in New Issue