Merge pull request #1 from bludit/master

sync
This commit is contained in:
Max Kostikov 2017-10-21 16:23:27 +02:00 committed by GitHub
commit cdf4293722
6 changed files with 42 additions and 37 deletions

3
.gitignore vendored
View File

@ -2,4 +2,5 @@
bl-content/* bl-content/*
bl-plugins/timemachine bl-plugins/timemachine
bl-plugins/remote-content bl-plugins/remote-content
bl-kernel/bludit.pro.php bl-kernel/bludit.pro.php
bl-themes/docs

View File

@ -386,10 +386,10 @@ class dbPages extends dbJSON
// Returns an array with all parents pages key, a parent page is not a child // Returns an array with all parents pages key, a parent page is not a child
public function getParents() public function getParents()
{ {
$db = $this->getPublishedDB(); $db = $this->getPublishedDB() + $this->getStaticDB();
foreach($db as $key=>$fields) { foreach ($db as $key=>$fields) {
// if the key has slash then is a child // if the key has slash then is a child
if( Text::stringContains($key, '/') ) { if (Text::stringContains($key, '/')) {
unset($db[$key]); unset($db[$key]);
} }
} }

View File

@ -232,5 +232,6 @@
"scheduled": "Scheduled", "scheduled": "Scheduled",
"this-token-is-similar-to-a-password-it-should-not-be-shared": "This token is similar to a password, it should not be shared.", "this-token-is-similar-to-a-password-it-should-not-be-shared": "This token is similar to a password, it should not be shared.",
"congratulations-you-have-successfully-installed-your-bludit": "Congratulations you have successfully installed your **Bludit**.", "congratulations-you-have-successfully-installed-your-bludit": "Congratulations you have successfully installed your **Bludit**.",
"this-theme-may-not-be-supported-by-this-version-of-bludit": "This theme may not be supported by this version of Bludit" "this-theme-may-not-be-supported-by-this-version-of-bludit": "This theme may not be supported by this version of Bludit",
} "read-more": "Read more"
}

View File

@ -231,5 +231,6 @@
"scheduled": "Запланировано", "scheduled": "Запланировано",
"this-token-is-similar-to-a-password-it-should-not-be-shared": "Этот токен похож на пароль, он не должен демонстрироваться.", "this-token-is-similar-to-a-password-it-should-not-be-shared": "Этот токен похож на пароль, он не должен демонстрироваться.",
"congratulations-you-have-successfully-installed-your-bludit": "Поздравляем! Вы успешно установили **Bludit**", "congratulations-you-have-successfully-installed-your-bludit": "Поздравляем! Вы успешно установили **Bludit**",
"this-theme-may-not-be-supported-by-this-version-of-bludit": "Эта тема может не поддерживаться текущей версией Bludit" "this-theme-may-not-be-supported-by-this-version-of-bludit": "Эта тема может не поддерживаться текущей версией Bludit",
"read-more": "Далее"
} }

View File

@ -168,14 +168,14 @@ class pluginAPI extends Plugin {
$inputs = $_GET; $inputs = $_GET;
break; break;
case "PUT": case "PUT":
$inputs = file_get_contents("php://input"); $inputs = '';
break; break;
default: default:
$inputs = json_encode(array()); $inputs = json_encode(array());
break; break;
} }
// Try to get raw data // Try to get raw/json data
if (empty($inputs)) { if (empty($inputs)) {
$inputs = file_get_contents('php://input'); $inputs = file_get_contents('php://input');
} }
@ -183,6 +183,25 @@ class pluginAPI extends Plugin {
return $this->cleanInputs($inputs); 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) private function getEndpointParameters($URI)
{ {
// ENDPOINT Parameters // ENDPOINT Parameters
@ -202,23 +221,6 @@ class pluginAPI extends Plugin {
return $parameters; 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()) private function response($code=200, $message='OK', $data=array())
{ {
header('HTTP/1.1 '.$code.' '.$message); header('HTTP/1.1 '.$code.' '.$message);

View File

@ -70,15 +70,15 @@
<!-- Pagination --> <!-- Pagination -->
<ul class="actions pagination"> <ul class="actions pagination">
<?php
// Show previus page link
if(Paginator::showPrev()) {
echo '<li><a href="'.Paginator::prevPageUrl().'" class="button big previous">Previous Page</a></li>';
}
// Show next page link <!-- Show previus page link -->
if(Paginator::showNext()) { <?php if(Paginator::showPrev()) { ?>
echo '<li><a href="'.Paginator::nextPageUrl().'" class="button big next">Next Page</a></li>'; <li><a href="<?php echo Paginator::prevPageUrl() ?>" class="button big previous"><?php $Language->p('Previous Page') ?></a></li>
} <?php } ?>
?>
</ul> <!-- Show next page link -->
<?php if(Paginator::showNext()) { ?>
<li><a href="<?php echo Paginator::nextPageUrl() ?>" class="button big next"><?php $Language->p('Next Page') ?></a></li>
<?php } ?>
</ul>