Fixed API and changes on themes

This commit is contained in:
Diego Najar 2017-08-30 20:02:31 +02:00
parent 24724a3c90
commit a1fccbac14
2 changed files with 8 additions and 5 deletions

View File

@ -73,6 +73,7 @@ class pluginAPI extends Plugin {
// API TOKEN
// ------------------------------------------------------------
// Token from the plugin, the user can change it on the settings of the plugin
$tokenAPI = $this->getValue('token');
// Check empty token
@ -80,7 +81,7 @@ class pluginAPI extends Plugin {
$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) {
$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 | POST | create a new page
$URI = ltrim($URI, '/');
$parameters = explode('/', $URI);
// Sanitize parameters
@ -193,6 +195,7 @@ class pluginAPI extends Plugin {
private function response($code=200, $message='OK', $data=array())
{
header('HTTP/1.1 '.$code.' '.$message);
header('Access-Control-Allow-Origin: *');
header('Content-Type: application/json');
$json = json_encode($data);
exit($json);

View File

@ -1,5 +1,5 @@
<?php
$GITHUB_BASE_URL = 'https://github.com/dignajar/bludit-documentation-english/tree/master/';
$GITHUB_BASE_URL = '__GITHUB_BASE_URL__';
if (!$Site->homepage()) {
echo 'This theme need a home page defined, please select one page on <b>Admin panel->Settings->Advanced->Home page</b>';