Fixed API and changes on themes
This commit is contained in:
parent
24724a3c90
commit
a1fccbac14
|
@ -73,6 +73,7 @@ class pluginAPI extends Plugin {
|
||||||
|
|
||||||
// API TOKEN
|
// API TOKEN
|
||||||
// ------------------------------------------------------------
|
// ------------------------------------------------------------
|
||||||
|
// Token from the plugin, the user can change it on the settings of the plugin
|
||||||
$tokenAPI = $this->getValue('token');
|
$tokenAPI = $this->getValue('token');
|
||||||
|
|
||||||
// Check empty token
|
// Check empty token
|
||||||
|
@ -80,7 +81,7 @@ class pluginAPI extends Plugin {
|
||||||
$this->response(404, 'Not Found', array('message'=>'Missing API token.'));
|
$this->response(404, 'Not Found', array('message'=>'Missing API token.'));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check the token is valid
|
// Check if the token is valid
|
||||||
if ($inputs['token']!==$tokenAPI) {
|
if ($inputs['token']!==$tokenAPI) {
|
||||||
$this->response(401, 'Unauthorized', array('message'=>'Invalid API token.'));
|
$this->response(401, 'Unauthorized', array('message'=>'Invalid API token.'));
|
||||||
}
|
}
|
||||||
|
@ -164,6 +165,7 @@ class pluginAPI extends Plugin {
|
||||||
// /api/pages/{key} | GET | returns the page with the {key}
|
// /api/pages/{key} | GET | returns the page with the {key}
|
||||||
// /api/pages | POST | create a new page
|
// /api/pages | POST | create a new page
|
||||||
|
|
||||||
|
$URI = ltrim($URI, '/');
|
||||||
$parameters = explode('/', $URI);
|
$parameters = explode('/', $URI);
|
||||||
|
|
||||||
// Sanitize parameters
|
// Sanitize parameters
|
||||||
|
@ -193,6 +195,7 @@ class pluginAPI extends Plugin {
|
||||||
private function response($code=200, $message='OK', $data=array())
|
private function response($code=200, $message='OK', $data=array())
|
||||||
{
|
{
|
||||||
header('HTTP/1.1 '.$code.' '.$message);
|
header('HTTP/1.1 '.$code.' '.$message);
|
||||||
|
header('Access-Control-Allow-Origin: *');
|
||||||
header('Content-Type: application/json');
|
header('Content-Type: application/json');
|
||||||
$json = json_encode($data);
|
$json = json_encode($data);
|
||||||
exit($json);
|
exit($json);
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<?php
|
<?php
|
||||||
$GITHUB_BASE_URL = 'https://github.com/dignajar/bludit-documentation-english/tree/master/';
|
$GITHUB_BASE_URL = '__GITHUB_BASE_URL__';
|
||||||
|
|
||||||
if (!$Site->homepage()) {
|
if (!$Site->homepage()) {
|
||||||
echo 'This theme need a home page defined, please select one page on <b>Admin panel->Settings->Advanced->Home page</b>';
|
echo 'This theme need a home page defined, please select one page on <b>Admin panel->Settings->Advanced->Home page</b>';
|
||||||
|
|
Loading…
Reference in New Issue