This commit is contained in:
Diego Najar 2017-07-07 23:38:01 +02:00
parent 1c0038bc55
commit 34a6535b12
8 changed files with 106 additions and 55 deletions

View File

@ -28,6 +28,7 @@ class Plugin {
// (array) Database fields, only for initialize
public $dbFields;
// (boolean) Enable or disable default Save and Cancel button on plugin settings
public $formButtons;
function __construct()
@ -274,7 +275,8 @@ class Plugin {
}
// Returns the parameters after the URI, FALSE if the URI doesn't match with the webhook
public function webhook($URI=false)
// Example: https://www.mybludit.com/api/foo/bar
public function webhook($URI=false, $returnsAfterURI=false)
{
global $Url;
@ -290,6 +292,10 @@ class Plugin {
return false;
}
if($returnsAfterURI) {
return mb_substr($URI, $length);
}
Log::set(__METHOD__.LOG_SEP.'Webhook requested.');
return true;
}

View File

@ -98,14 +98,20 @@ body {
max-width: 1800px;
}
#bl-navbar img.logo {
height: 25px;
margin-bottom: 6px;
margin-left: 15px;
margin-right: 5px;
}
#bl-navbar a {
color: #fff;
}
#bl-navbar a.bl-brand {
font-size: 20px;
line-height: 60px;
margin: 0 0 0 35px;
font-size: 15px;
line-height: 35px;
text-transform: uppercase;
color: #fff;
}
@ -116,7 +122,7 @@ body {
#bl-navbar .bl-navbar-right {
float: right;
line-height: 60px;
line-height: 35px;
margin: 0 35px 0 0;
}
@ -637,41 +643,27 @@ div.plugin-links > span.separator {
list-style-type: none;
margin: 15px 0;
padding: 0;
font-size: 0.9em;
font-size: 1em;
text-align: center;
}
#paginator li.next {
margin-left: 1em;
}
#paginator li.previous {
margin-right: 1em;
}
#paginator a {
color: #2672ec;
}
#paginator li {
display: inline;
float: none !important;
margin: 0 5px;
}
#paginator li.left {
margin-right: 10px;
}
#paginator li.list {
background: #e0e0e0;
color: #747474;
padding: 2px 11px;
margin: 0px 15px;
}
#paginator li.right {
margin-left: 10px;
}
#paginator li.next {
margin-right: 1em;
}
#paginator li.previous {
margin-left: 1em;
}
/* ----------- PLUGINS FORM ----------- */

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1005 B

After

Width:  |  Height:  |  Size: 862 B

View File

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<svg viewBox="0 0 500 500" xmlns="http://www.w3.org/2000/svg">
<defs>
<pattern id="pattern-0" x="0" y="0" width="20" height="20" patternUnits="userSpaceOnUse" viewBox="0 0 100 100">
<path d="M 0 0 L 50 0 L 50 100 L 0 100 Z" style="fill: black;"/>
</pattern>
</defs>
<path style="fill: rgb(255, 255, 255); stroke: rgb(0, 0, 0); stroke-miterlimit: 4; stroke-dasharray: none; stroke-width: 24.1239;" d="M 145.686 14.63 C 141.613 8.89 130.833 68.155 113.248 128.344 C 108.415 144.89 115.288 161.582 117.782 176.059 C 121.971 183.412 126.134 194.145 129.663 207.523 C 130.852 212.029 131.89 216.619 132.816 221.212 C 123.039 245.985 117.522 274.055 117.522 303.808 C 117.522 331.213 122.224 357.181 130.601 380.471 C 146.382 392.392 161.695 409.741 174.269 431.302 C 180.153 441.39 185.014 451.718 188.888 461.98 C 209.024 476.655 232.243 485.043 256.97 485.043 C 280.324 485.043 302.327 477.571 321.665 464.381 C 325.671 453.331 330.362 441.894 337.169 431.302 C 350.642 410.34 367.256 390.2 384.224 378 C 395.979 359.286 397.512 331.335 396.418 303.808 C 395.283 275.244 391.314 248.191 382.244 224.145 C 383.028 218.304 384.004 212.46 385.214 206.717 C 388.261 192.245 392.179 180.77 396.288 173.244 C 397.911 159.088 403.396 142.737 398.19 126.913 C 377.42 63.769 380.058 117.247 374.011 122.306 C 366.364 128.705 325.935 65.939 327.529 128.344 C 327.702 135.15 328.069 141.8 328.596 148.266 C 307.662 131.942 282.324 152.098 256.136 152.098 C 229.291 152.098 205.058 132.425 183.779 149.512 C 184.059 142.203 184.108 134.65 183.911 126.913 C 182.317 64.508 171.016 50.32 145.686 14.63 Z" id="path2987"/>
<path id="path3763" d="M 256.314 390.825 C 246.312 390.825 223.405 410.421 223.405 423.826 C 223.405 427.497 224.537 430.973 226.554 434.092 C 230.352 435.689 234.037 438.012 237.065 440.902 C 238.481 442.253 239.65 443.635 240.582 445.009 C 245.429 446.974 251.018 448.098 256.97 448.098 C 262.593 448.098 267.889 447.097 272.542 445.33 C 273.509 443.851 274.748 442.358 276.274 440.902 C 279.518 437.806 283.517 435.361 287.6 433.762 C 289.485 430.731 290.537 427.367 290.537 423.826 C 290.537 410.421 266.971 390.825 256.314 390.825 Z" style="fill: rgb(0, 0, 0); stroke: rgb(0, 0, 0); stroke-miterlimit: 4; stroke-dasharray: none; stroke-width: 24.1239;"/>
<path style="fill: rgb(0, 0, 0); stroke: rgb(0, 0, 0); stroke-linecap: butt; stroke-linejoin: miter; stroke-miterlimit: 4; stroke-dasharray: none; stroke-width: 24.1239;" d="M 228.658 314.39 C 264.037 255.967 201.722 177.034 170.636 242.749 C 156.716 272.177 189.433 341.163 228.658 314.39 Z" id="path3779"/>
<path style="fill: rgb(0, 0, 0); stroke: rgb(0, 0, 0); stroke-miterlimit: 4; stroke-width: 18;" d="M 323.461 270.414 C 323.461 276.224 318.143 280.937 311.582 280.937 C 305.022 280.937 299.702 276.224 299.702 270.414 C 299.702 264.6 305.022 259.888 311.582 259.888 C 318.143 259.888 323.461 264.6 323.461 270.414 Z" id="path3785"/>
<path style="stroke: rgb(0, 0, 0); stroke-miterlimit: 4; fill: rgb(255, 255, 255); stroke-width: 24.1239;" d="M 232.976 268.819 C 232.976 284.42 220.013 297.069 204.021 297.069 C 188.032 297.069 175.068 284.42 175.068 268.819 C 175.068 253.21 188.032 240.565 204.021 240.565 C 220.013 240.565 232.976 253.21 232.976 268.819 Z" id="path-1"/>
</svg>

After

Width:  |  Height:  |  Size: 3.2 KiB

View File

@ -8,7 +8,7 @@
<title><?php echo $layout['title'] ?></title>
<!-- Favicon -->
<link rel="shortcut icon" type="image/x-icon" href="<?php echo HTML_PATH_ADMIN_THEME.'img/favicon.png' ?>">
<link rel="shortcut icon" type="image/x-icon" href="<?php echo HTML_PATH_ADMIN_THEME.'img/favicon.png?'.time() ?>">
<!-- CSS -->
<link rel="stylesheet" type="text/css" href="<?php echo HTML_PATH_ADMIN_THEME.'css/uikit/uikit.almost-flat.min.css?version='.BLUDIT_VERSION ?>">
@ -57,16 +57,14 @@ $(document).ready(function() {
<div class="uk-offcanvas-bar">
<ul class="uk-nav uk-nav-offcanvas">
<li><a href="<?php echo HTML_PATH_ADMIN_ROOT.'dashboard' ?>"><?php $L->p('Dashboard') ?></a></li>
<li><a href="<?php echo HTML_PATH_ADMIN_ROOT.'new-post' ?>"><?php $L->p('New post') ?></a></li>
<li><a href="<?php echo HTML_PATH_ADMIN_ROOT.'new-page' ?>"><?php $L->p('New page') ?></a></li>
<li><a href="<?php echo HTML_PATH_ADMIN_ROOT.'manage-posts' ?>"><?php $L->p('Manage posts') ?></a></li>
<li><a href="<?php echo HTML_PATH_ADMIN_ROOT.'manage-pages' ?>"><?php $L->p('Manage pages') ?></a></li>
<li><a href="<?php echo HTML_PATH_ADMIN_ROOT.'new-page' ?>"><?php $L->p('New content') ?></a></li>
<li><a href="<?php echo HTML_PATH_ADMIN_ROOT.'manage-pages' ?>"><?php $L->p('Manage content') ?></a></li>
<?php if($Login->role() == 'admin') { ?>
<li><a href="<?php echo HTML_PATH_ADMIN_ROOT.'categories' ?>"><?php $L->p('Manage categories') ?></a></li>
<li><a href="<?php echo HTML_PATH_ADMIN_ROOT.'users' ?>"><?php $L->p('Manage users') ?></a></li>
<!-- <li><a href="<?php echo HTML_PATH_ADMIN_ROOT.'categories' ?>"><?php $L->p('Manage categories') ?></a></li> -->
<li><a href="<?php echo HTML_PATH_ADMIN_ROOT.'settings-general' ?>"><?php $L->p('General settings') ?></a></li>
<li><a href="<?php echo HTML_PATH_ADMIN_ROOT.'settings-advanced' ?>"><?php $L->p('Advanced settings') ?></a></li>
<li><a href="<?php echo HTML_PATH_ADMIN_ROOT.'settings-regional' ?>"><?php $L->p('Language and timezone') ?></a></li>
<li><a href="<?php echo HTML_PATH_ADMIN_ROOT.'settings-regional' ?>"><?php $L->p('Language') ?></a></li>
<li><a href="<?php echo HTML_PATH_ADMIN_ROOT.'plugins' ?>"><?php $L->p('Plugins') ?></a></li>
<li><a href="<?php echo HTML_PATH_ADMIN_ROOT.'themes' ?>"><?php $L->p('Themes') ?></a></li>
<li><a href="<?php echo HTML_PATH_ADMIN_ROOT.'about' ?>"><?php $L->p('About') ?></a></li>
@ -77,6 +75,7 @@ $(document).ready(function() {
<div class="bl-navbar-bg">
<nav id="bl-navbar">
<img class="logo" src="<?php echo HTML_PATH_ADMIN_THEME ?>img/logo.svg" />
<a href="" class="bl-brand">BLUDIT</a>
<div class="bl-navbar-right">

View File

@ -39,3 +39,25 @@ echo '
</tbody>
</table>
';
?>
<!-- Paginator -->
<div id="paginator">
<ul>
<?php
// Show previus page link
if(Paginator::showPrev()) {
echo '<li class="first"><a href="'.Paginator::prevPageUrl().'" class="previous"><- Previous</a></li>';
}
for($i=1; $i<=Paginator::amountOfPages(); $i++) {
echo '<li><a href='.Paginator::absoluteUrl($i).' class="page">'.$i.'</a></li>';
}
// Show next page link
if(Paginator::showNext()) {
echo '<li class="next"><a href="'.Paginator::nextPageUrl().'" class="next">Next -></a></li>';
}
?>
</ul>
</div>

View File

@ -1,5 +1,6 @@
<?php defined('BLUDIT') or die('Bludit CMS.');
// (object) Returns a Page object, the class is page.class.php, FALSE if something fail to load the page
function buildPage($key)
{
global $dbPages;
@ -208,6 +209,7 @@ function editPage($args) {
// The user is always the one loggued
$args['username'] = Session::get('username');
if( Text::isEmpty($args['username']) ) {
Log::set('Function editPage()'.LOG_SEP.'Empty username.');
return false;
}
@ -235,6 +237,7 @@ function editPage($args) {
return $key;
}
Log::set('Function editPage()'.LOG_SEP.'ERROR: Something happen when try to edit the page.');
return false;
}
@ -304,8 +307,7 @@ function editUser($args) {
return false;
}
function deleteUser($args, $deleteContent=false)
{
function deleteUser($args, $deleteContent=false) {
global $dbUsers;
global $Login;
global $Syslog;
@ -384,8 +386,6 @@ function createUser($args) {
'notes'=>$tmp['username']
));
// Create an alert
Alert::set($Language->g('user-has-been-added-successfully'), ALERT_STATUS_OK);
return true;
}

View File

@ -46,7 +46,7 @@ class pluginAPI extends Plugin {
// CHECK URL
// ------------------------------------------------------------
$URI = $this->webhook('api');
$URI = $this->webhook('api', $returnsAfterURI=true);
if( $URI===false ) {
return false;
}
@ -59,10 +59,24 @@ class pluginAPI extends Plugin {
// ------------------------------------------------------------
$inputs = $this->getInputs();
if( empty($inputs) ) {
$this->response(array(
'status'=>'1',
'message'=>'Missing inputs.'
));
}
// PARAMETERS
// ------------------------------------------------------------
$parameters = $this->getParameters($URI);
if( empty($parameters) ) {
$this->response(array(
'status'=>'1',
'message'=>'Missing parameters.'
));
}
// API TOKEN
// ------------------------------------------------------------
$tokenAPI = $this->getValue('token');
@ -172,19 +186,24 @@ class pluginAPI extends Plugin {
break;
}
if(!is_string($inputs)) {
return false;
return $this->cleanInputs($inputs);
}
// Input data need to be JSON
$inputs = json_decode($inputs,true);
// Sanitize inputs
private function cleanInputs($inputs)
{
$tmp = array();
if( is_array($inputs) ) {
foreach($inputs as $key=>$value) {
$inputs[$key] = Sanitize::html($value);
$tmp[$key] = Sanitize::html($value);
}
return $inputs;
}
elseif( is_string($inputs) ) {
$tmp = json_decode($inputs, true);
if(json_last_error()===0) {
$tmp = array();
}
}
return $tmp;
}
private function response($data=array())
@ -240,10 +259,10 @@ class pluginAPI extends Plugin {
return $tmp;
}
private function newPage($args)
private function createPage($args)
{
// This function is defined on functions.php
return createNewPage($args);
return createPage($args);
}
}