Bug fixes: Static content as parents
This commit is contained in:
parent
56041fb5a1
commit
b089edfa51
|
@ -2,4 +2,5 @@
|
|||
bl-content/*
|
||||
bl-plugins/timemachine
|
||||
bl-plugins/remote-content
|
||||
bl-kernel/bludit.pro.php
|
||||
bl-kernel/bludit.pro.php
|
||||
bl-themes/docs
|
||||
|
|
|
@ -386,10 +386,10 @@ class dbPages extends dbJSON
|
|||
// Returns an array with all parents pages key, a parent page is not a child
|
||||
public function getParents()
|
||||
{
|
||||
$db = $this->getPublishedDB();
|
||||
foreach($db as $key=>$fields) {
|
||||
$db = $this->getPublishedDB() + $this->getStaticDB();
|
||||
foreach ($db as $key=>$fields) {
|
||||
// if the key has slash then is a child
|
||||
if( Text::stringContains($key, '/') ) {
|
||||
if (Text::stringContains($key, '/')) {
|
||||
unset($db[$key]);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -168,14 +168,14 @@ class pluginAPI extends Plugin {
|
|||
$inputs = $_GET;
|
||||
break;
|
||||
case "PUT":
|
||||
$inputs = file_get_contents("php://input");
|
||||
$inputs = '';
|
||||
break;
|
||||
default:
|
||||
$inputs = json_encode(array());
|
||||
break;
|
||||
}
|
||||
|
||||
// Try to get raw data
|
||||
// Try to get raw/json data
|
||||
if (empty($inputs)) {
|
||||
$inputs = file_get_contents('php://input');
|
||||
}
|
||||
|
@ -183,6 +183,25 @@ class pluginAPI extends Plugin {
|
|||
return $this->cleanInputs($inputs);
|
||||
}
|
||||
|
||||
// Returns an array with key=>value
|
||||
// If the content is JSON is parsed to array
|
||||
private function cleanInputs($inputs)
|
||||
{
|
||||
$tmp = array();
|
||||
if (is_array($inputs)) {
|
||||
foreach ($inputs as $key=>$value) {
|
||||
$tmp[$key] = Sanitize::html($value);
|
||||
}
|
||||
} elseif (is_string($inputs)) {
|
||||
$tmp = json_decode($inputs, true);
|
||||
if (json_last_error()!==JSON_ERROR_NONE) {
|
||||
$tmp = array();
|
||||
}
|
||||
}
|
||||
|
||||
return $tmp;
|
||||
}
|
||||
|
||||
private function getEndpointParameters($URI)
|
||||
{
|
||||
// ENDPOINT Parameters
|
||||
|
@ -202,23 +221,6 @@ class pluginAPI extends Plugin {
|
|||
return $parameters;
|
||||
}
|
||||
|
||||
private function cleanInputs($inputs)
|
||||
{
|
||||
$tmp = array();
|
||||
if (is_array($inputs)) {
|
||||
foreach ($inputs as $key=>$value) {
|
||||
$tmp[$key] = Sanitize::html($value);
|
||||
}
|
||||
} elseif(is_string($inputs)) {
|
||||
$tmp = json_decode($inputs, true);
|
||||
if (json_last_error()!==JSON_ERROR_NONE) {
|
||||
$tmp = array();
|
||||
}
|
||||
}
|
||||
|
||||
return $tmp;
|
||||
}
|
||||
|
||||
private function response($code=200, $message='OK', $data=array())
|
||||
{
|
||||
header('HTTP/1.1 '.$code.' '.$message);
|
||||
|
|
Loading…
Reference in New Issue