Commit c6c8fffb authored by Malcolm Blaney's avatar Malcolm Blaney

Adding initial version of new Settings module, which is checked

for by user.php, which introduces a new dependency on module.php.
This meant a lot of php files needed the extra include, so they
also received some minor formatting changes.
parent 3f9a1d1a
Pipeline #8463878 passed with stage
in 1 minute and 35 seconds
......@@ -28,6 +28,7 @@ php/modules/Report.php
php/modules/Roster.php
php/modules/Section.php
php/modules/Sell.php
php/modules/Settings.php
php/modules/Slider.php
php/modules/Spark.php
php/modules/Start.php
......@@ -67,6 +68,7 @@ js/dobrado.report.js
js/dobrado.roster.js
js/dobrado.section.js
js/dobrado.sell.js
js/dobrado.settings.js
js/dobrado.slider.js
js/dobrado.spark.js
js/dobrado.start.js
......@@ -105,6 +107,7 @@ js/source/dobrado.report.js
js/source/dobrado.roster.js
js/source/dobrado.section.js
js/source/dobrado.sell.js
js/source/dobrado.settings.js
js/source/dobrado.slider.js
js/source/dobrado.spark.js
js/source/dobrado.start.js
......
......@@ -668,7 +668,7 @@ class Reader extends Base {
// to check if anything has changed in this case.
if (!$feed->get_raw_data()) return false;
include 'library/HTMLPurifier.auto.php';
include_once 'library/HTMLPurifier.auto.php';
$config = HTMLPurifier_Config::createDefault();
// Allow iframes from youtube and vimeo.
$config->set('HTML.SafeIframe', true);
......
This diff is collapsed.
This diff is collapsed.
// @source: /js/source/dobrado.settings.js
//
// @licstart The following is the entire license notice
// for the JavaScript code in this page.
//
// Copyright (C) 2017 Malcolm Blaney
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// As additional permission under GNU AGPL version 3 section 7, you
// may distribute non-source (e.g., minimized or compacted) forms of
// that code without the copy of the GNU GPL normally required by
// section 4, provided you include this license notice and a URL
// through which recipients can access the Corresponding Source.
//
// @licend The above is the entire license notice
// for the JavaScript code in this page.
if(!this.dobrado.settings){dobrado.settings={};}
(function(){'use strict';$(function(){if($('.settings').length===0){return;}
$('.settings input[type=checkbox]').checkboxradio();$('.settings input[type=radio]').checkboxradio();$('.settings .datepicker').datepicker({dateFormat:dobrado.dateFormat});$('.settings .show-password').button().click(function(){if($(this).siblings('input').attr('type')==='password'){$(this).siblings('input').attr('type','text');}
else{$(this).siblings('input').attr('type','password');}});$('.settings :input').change(save);});function save(){dobrado.log('Saving setting.','info');$.post('/php/request.php',{request:'settings',action:'save',id:$(this).attr('id'),value:$(this).val(),url:location.href,token:dobrado.token},function(response){if(dobrado.checkResponseError(response,'settings save')){return false;}});}})();
\ No newline at end of file
/*global dobrado: true */
// @licstart The following is the entire license notice
// for the JavaScript code in this page.
//
// Copyright (C) 2017 Malcolm Blaney
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// As additional permission under GNU AGPL version 3 section 7, you
// may distribute non-source (e.g., minimized or compacted) forms of
// this code without the copy of the GNU GPL normally required by
// section 4, provided you include this license notice and a URL
// through which recipients can access the Corresponding Source.
//
// @licend The above is the entire license notice
// for the JavaScript code in this page.
if (!this.dobrado.settings) {
dobrado.settings = {};
}
(function() {
'use strict';
$(function() {
// Don't run if the module isn't on the page.
if ($('.settings').length === 0) {
return;
}
$('.settings input[type=checkbox]').checkboxradio();
$('.settings input[type=radio]').checkboxradio();
$('.settings .datepicker').datepicker({
dateFormat: dobrado.dateFormat });
$('.settings .show-password').button().click(function() {
if ($(this).siblings('input').attr('type') === 'password') {
$(this).siblings('input').attr('type', 'text');
}
else {
$(this).siblings('input').attr('type', 'password');
}
});
$('.settings :input').change(save);
});
function save() {
dobrado.log('Saving setting.', 'info');
$.post('/php/request.php', { request: 'settings',
action: 'save',
id: $(this).attr('id'),
value: $(this).val(),
url: location.href,
token: dobrado.token },
function(response) {
if (dobrado.checkResponseError(response, 'settings save')) {
return false;
}
});
}
})();
......@@ -85,6 +85,7 @@ if (isset($_SESSION['token-endpoint']) && $_SESSION['token-endpoint'] !== '') {
if (!isset($_SESSION['access-token'])) $_SESSION['micropub-endpoint'] = NULL;
include 'config.php';
include 'module.php';
include 'user.php';
$exists = false;
......
<?php
// Dobrado Content Management System
// Copyright (C) 2016 Malcolm Blaney
// Copyright (C) 2017 Malcolm Blaney
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
......@@ -19,9 +19,9 @@ include 'functions/session.php';
if (session_expired()) exit;
foreach (array('url', 'style', 'media') as $name) {
foreach (['url', 'style', 'media'] as $name) {
if (!isset($_POST[$name])) {
echo json_encode(array('error' => $name.' not provided'));
echo json_encode(['error' => $name.' not provided']);
exit;
}
}
......@@ -32,6 +32,7 @@ include 'functions/permission.php';
include 'functions/write_style.php';
include 'config.php';
include 'module.php';
include 'user.php';
$mysqli = connect_db();
......@@ -109,4 +110,4 @@ if ($owner === 'admin') write_box_style($owner, '../style.css');
else write_box_style($owner, '../'.$owner.'/style.css');
// Let the client know the action completed.
echo json_encode(array('done' => true));
echo json_encode(['done' => true]);
<?php
// Dobrado Content Management System
// Copyright (C) 2016 Malcolm Blaney
// Copyright (C) 2017 Malcolm Blaney
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
......@@ -19,9 +19,9 @@ include 'functions/session.php';
if (session_expired()) exit;
foreach (array('id', 'label', 'url') as $name) {
foreach (['id', 'label', 'url'] as $name) {
if (!isset($_POST[$name])) {
echo json_encode(array('error' => $name.' not provided'));
echo json_encode(['error' => $name.' not provided']);
exit;
}
}
......@@ -57,12 +57,12 @@ if ($module->CanEdit($id)) {
if ($user->canEditPage || ($label === 'post' && $user->canViewPage)) {
$module->SetContent($id, $us_content);
// Return the updated content.
echo json_encode(array('html' => $module->Content($id)));
echo json_encode(['html' => $module->Content($id)]);
}
else {
echo json_encode(array('done' => true));
echo json_encode(['done' => true]);
}
}
else {
echo json_encode(array('error' => 'could not edit module'));
echo json_encode(['error' => 'could not edit module']);
}
<?php
// Dobrado Content Management System
// Copyright (C) 2016 Malcolm Blaney
// Copyright (C) 2017 Malcolm Blaney
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
......@@ -19,9 +19,9 @@ include 'functions/session.php';
if (session_expired()) exit;
foreach (array('page', 'owner', 'url') as $name) {
foreach (['page', 'owner', 'url'] as $name) {
if (!isset($_POST[$name])) {
echo json_encode(array('error' => $name.' not provided'));
echo json_encode(['error' => $name.' not provided']);
exit;
}
}
......@@ -33,6 +33,7 @@ include 'functions/permission.php';
include 'functions/write_style.php';
include 'config.php';
include 'module.php';
include 'user.php';
$mysqli = connect_db();
......@@ -45,7 +46,7 @@ $user = new User();
$user->SetPermission($current_page, $current_owner);
if (!$user->canCopyPage) {
$error = 'Could not copy the current page: Permission denied.';
echo json_encode(array('error' => $error));
echo json_encode(['error' => $error]);
$mysqli->close();
exit;
}
......@@ -73,7 +74,7 @@ if ($new_owner === '') {
if (!can_edit_page($new_owner.'/'.$new_page)) {
$error = 'Could not copy to page: <b>'.$new_owner.'/'.$new_page.
'</b>.<br/>Please make sure you have permission to edit that page.';
echo json_encode(array('error' => $error));
echo json_encode(['error' => $error]);
$mysqli->close();
exit;
}
......@@ -94,14 +95,13 @@ else {
$mysqli->close();
if ($error !== '') {
echo json_encode(array('error' => $error));
echo json_encode(['error' => $error]);
exit;
}
include 'module.php';
$name = copy_page($current_page, $current_owner, $new_page, $new_owner);
// Set the reload-page session variable so that the browser forces a page
// reload to get updated css files.
$_SESSION['reload-page'] = true;
echo json_encode(array('name' => $name));
echo json_encode(['name' => $name]);
......@@ -132,18 +132,18 @@ function new_user($user, $owner, $active = 1,
chmod($prefix.$user->name.'/index.php', 0644);
$handle = fopen($prefix.$user->name.'/owner.php', 'w');
fwrite($handle, '<?php $owner="'.$user->name.'"; ?>');
fwrite($handle, '<?php $owner=\''.$user->name.'\';');
fclose($handle);
chmod($prefix.$user->name.'/owner.php', 0644);
$handle = fopen($prefix.$user->name.'/rss/index.php', 'w');
fwrite($handle, "<?php\n".
'include "../../php/functions/db.php";'."\n".
'include "../../php/functions/rss.php";'."\n".
'include "../../php/config.php";'."\n".
'include "../../php/user.php";'."\n".
'rss("'.$user->name.'");'."\n".
'?>');
"include '../../php/functions/db.php';\n".
"include '../../php/functions/rss.php';\n".
"include '../../php/config.php';\n".
"include '../../php/module.php';\n".
"include '../../php/user.php';\n".
"rss('".$user->name."');\n");
fclose($handle);
chmod($prefix.$user->name.'/rss/index.php', 0644);
......
<?php
// Dobrado Content Management System
// Copyright (C) 2016 Malcolm Blaney
// Copyright (C) 2017 Malcolm Blaney
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
......@@ -85,7 +85,7 @@ function rss($username) {
$query = 'SELECT box_id, label FROM notify WHERE user = "'.$user->name.'" '.
'AND page = "'.$page.'" AND action = "'.$action.'" AND public = 1 AND '.
'timestamp > '.strtotime('-24 hours').' ORDER BY timestamp DESC';
$feed = array();
$feed = [];
if ($result = $mysqli->query($query)) {
while ($notify = $result->fetch_assoc()) {
$feed[] = $notify;
......
......@@ -26,6 +26,7 @@ include 'functions/page_owner.php';
include 'functions/write_style.php';
include 'config.php';
include 'module.php';
include 'user.php';
$attributes = ['list' => [], 'locked' => false];
......@@ -69,10 +70,9 @@ $mysqli->close();
// Also allow tooltips to be shown to the user if they have a start module
// added to a page they own (which sets the 'start' session variable).
if (isset($_SESSION['start'])) {
include 'module.php';
$start = new Module($user, $owner, 'start');
if ($start->IsInstalled()) {
$attributes['tooltip'] = $start->Factory('tooltip');
$attributes['tooltip'] = $start->Factory('Tooltip');
}
}
......
<?php
// Dobrado Content Management System
// Copyright (C) 2016 Malcolm Blaney
// Copyright (C) 2017 Malcolm Blaney
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
......@@ -19,9 +19,9 @@ include 'functions/session.php';
if (session_expired()) exit;
foreach (array('label', 'version', 'title', 'description', 'url') as $name) {
foreach (['label', 'version', 'title', 'description', 'url'] as $name) {
if (!isset($_POST[$name])) {
echo json_encode(array('error' => $name.' not provided'));
echo json_encode(['error' => $name.' not provided']);
exit;
}
}
......@@ -30,6 +30,7 @@ include 'functions/db.php';
include 'functions/permission.php';
include 'functions/page_owner.php';
include 'config.php';
include 'module.php';
include 'user.php';
$mysqli = connect_db();
......@@ -46,12 +47,12 @@ $update = false;
$user = new User();
$user->SetPermission($page, $owner);
if (!$user->canEditSite) {
echo json_encode(array('error' => 'Permission denied installing module.'));
echo json_encode(['error' => 'Permission denied installing module.']);
exit;
}
if ($label === '') {
echo json_encode(array('error' => 'Please provide a module name.'));
echo json_encode(['error' => 'Please provide a module name.']);
exit;
}
......@@ -62,12 +63,12 @@ if (file_exists($php_source)) {
rename($php_source, $php_destination);
}
else {
echo json_encode(array('error' => 'No php file found for the module.'));
echo json_encode(['error' => 'No php file found for the module.']);
exit;
}
if (file_exists('../install/'.$js_name.'.js')) {
if (!is_readable('../install/'.$js_name.'.js')) {
echo json_encode(array('error' => 'Cannot read javascript install file.'));
echo json_encode(['error' => 'Cannot read javascript install file.']);
exit;
}
rename('../install/'.$js_name.'.js', '../js/'.$js_name.'.js');
......@@ -75,7 +76,7 @@ if (file_exists('../install/'.$js_name.'.js')) {
// Look for a matching 'source' file for the javascript.
if (file_exists('../install/'.$js_name.'.source.js')) {
if (!is_readable('../install/'.$js_name.'.source.js')) {
echo json_encode(array('error' => 'Cannot read javascript source file.'));
echo json_encode(['error' => 'Cannot read javascript source file.']);
exit;
}
rename('../install/'.$js_name.'.source.js', '../js/source/'.$js_name.'.js');
......@@ -89,7 +90,7 @@ if ($result = $mysqli->query($query)) {
$result->close();
if ($version !== '' && $version === $installed_modules['version']) {
$error = 'Module version: '.$version.' up to date.';
echo json_encode(array('error' => $error));
echo json_encode(['error' => $error]);
exit;
}
// If the version number doesn't match (or blank),
......@@ -153,12 +154,11 @@ if ($update && $new_css) {
include 'write_instance.php';
write_instance();
include 'module.php';
$module = new Module($user, $owner, $label);
// The module's Install method returns the result as an array,
// which can include information on dependencies.
$dependencies = array('done' => true);
$dependencies = ['done' => true];
if ($update) {
$module->Update();
// If updating a module that includes javascript need to re-write the
......@@ -199,7 +199,7 @@ if ($update) {
}
}
else if (!$dependencies = $module->Install('../js')) {
$dependencies = array('done' => true);
$dependencies = ['done' => true];
}
$mysqli->close();
......
<?php
// Dobrado Content Management System
// Copyright (C) 2016 Malcolm Blaney
// Copyright (C) 2017 Malcolm Blaney
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
......@@ -19,9 +19,9 @@ include 'functions/session.php';
if (session_expired()) exit;
foreach (array('id', 'box_order', 'url') as $name) {
foreach (['id', 'box_order', 'url'] as $name) {
if (!isset($_POST[$name])) {
echo json_encode(array('error' => $name.' not provided'));
echo json_encode(['error' => $name.' not provided']);
exit;
}
}
......@@ -32,6 +32,7 @@ include 'functions/permission.php';
include 'functions/update_layout.php';
include 'config.php';
include 'module.php';
include 'user.php';
$mysqli = connect_db();
......@@ -68,4 +69,4 @@ for ($i = 0; $i < $total; $i++) {
}
// Let the client know the action completed.
echo json_encode(array('done' => true));
echo json_encode(['done' => true]);
<?php
// Dobrado Content Management System
// Copyright (C) 2016 Malcolm Blaney
// Copyright (C) 2017 Malcolm Blaney
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
......@@ -20,7 +20,7 @@ include 'functions/session.php';
if (session_expired()) exit;
if (!isset($_POST['url'])) {
echo json_encode(array('error' => 'url not provided'));
echo json_encode(['error' => 'url not provided']);
exit;
}
......@@ -30,6 +30,7 @@ include 'functions/permission.php';
include 'functions/write_style.php';
include 'config.php';
include 'module.php';
include 'user.php';
$mysqli = connect_db();
......@@ -39,7 +40,7 @@ list($page, $owner) = page_owner($url);
$user = new User();
$user->SetPermission($page, $owner);
if (!$user->canEditPage) {
echo json_encode(array('error' => 'Permission denied editing layout.'));
echo json_encode(['error' => 'Permission denied editing layout.']);
$mysqli->close();
exit;
}
......@@ -48,7 +49,7 @@ $name = isset($_POST['name']) ? $mysqli->escape_string($_POST['name']) : '';
$difference = isset($_POST['difference']) ? (int)$_POST['difference'] : 0;
if ($difference === 0) {
echo json_encode(array('done' => true));
echo json_encode(['done' => true]);
$mysqli->close();
exit;
}
......@@ -57,7 +58,7 @@ if ($difference === 0) {
$property = '';
$value = '';
$matches = array();
$matches = [];
if ($name === 'left' || $name === 'right') {
// Check if middle has a margin set.
......@@ -111,7 +112,7 @@ $value = page_value($owner, $page, '.'.$name, $property);
if ($value === '') {
$value = site_value('.'.$name, $property);
}
$matches = array();
$matches = [];
preg_match('/^([0-9]+)px$/', $value, $matches);
if (isset($matches[1])) {
$value = $matches[1] + $difference;
......@@ -128,4 +129,4 @@ if ($owner === 'admin') write_page_style($owner, '../'.$page.'.css');
else write_page_style($owner, '../'.$owner.'/'.$page.'.css');
// Let the client know the action completed.
echo json_encode(array('done' => true));
echo json_encode(['done' => true]);
......@@ -245,7 +245,8 @@ class Control extends Base {
'"'.$media.'","label[for=control-layout]","display","none"',
'"","#control-page-form","float","right"',
'"","#control-page-form","margin","0 7px 2px 2px"',
'"","#page-input","width","150px"',
'"","#page-input","height","25px"',
'"","#page-input","width","200px"',
'"'.$media.'","#page-input","width","100px"',
'"","#page-select","width","150px"',
'"'.$media.'","#page-select","width","100px"',
......@@ -329,7 +330,7 @@ class Control extends Base {
'"The control bar can be fixed to the top of the browser window, or '.
'choosing static means it scrolls with the page."',
'"control","displayMessageButton","none,block","radio","The message '.
'button in the control bar is not currently used, so display should be '.
'button in the control bar is not currently used, so display can be '.
'set to \'none\'."']);
}
......
<?php
// Dobrado Content Management System
// Copyright (C) 2016 Malcolm Blaney
// Copyright (C) 2017 Malcolm Blaney
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
......@@ -19,9 +19,9 @@ include 'functions/session.php';
if (session_expired()) exit;
foreach (array('id', 'page', 'url') as $name) {
foreach (['id', 'page', 'url'] as $name) {
if (!isset($_POST[$name])) {
echo json_encode(array('error' => $name.' not provided'));
echo json_encode(['error' => $name.' not provided']);
exit;
}
}
......@@ -31,6 +31,7 @@ include 'functions/page_owner.php';
include 'functions/permission.php';
include 'config.php';
include 'module.php';
include 'user.php';
$mysqli = connect_db();
......@@ -41,23 +42,23 @@ $user = new User();
$user->SetPermission($page, $owner);
if (!$user->canEditPage) {
$error = 'Could not edit the current page: Permission denied.';
echo json_encode(array('error' => $error));
echo json_encode(['error' => $error]);
$mysqli->close();
return;
exit;
}
$new_page = $mysqli->escape_string($_POST['page']);
if ($new_page === $page) {
echo json_encode(array('done' => false));
return;
echo json_encode(['done' => false]);
exit;
}
if (!can_edit_page($new_page)) {
$error = 'Could not move to page: \''.$new_page.'\'.<br/>'.
'Please make sure you have permission to edit that page.';
echo json_encode(array('error' => $error));
return;
echo json_encode(['error' => $error]);
exit;
}
$id = $mysqli->escape_string($_POST['id']);
......@@ -79,4 +80,4 @@ if (!$mysqli->query($query)) {
$mysqli->close();
echo json_encode(array('done' => true));
echo json_encode(['done' => true]);
<?php
// Dobrado Content Management System
// Copyright (C) 2016 Malcolm Blaney
// Copyright (C) 2017 Malcolm Blaney
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
......@@ -19,9 +19,9 @@ include 'functions/session.php';
if (session_expired()) exit;
foreach (array('style', 'media', 'url') as $name) {
foreach (['style', 'media', 'url'] as $name) {
if (!isset($_POST[$name])) {
echo json_encode(array('error' => $name.' not provided'));
echo json_encode(['error' => $name.' not provided']);
exit;
}
}
......@@ -33,6 +33,7 @@ include 'functions/update_page_style.php';
include 'functions/write_style.php';
include 'config.php';
include 'module.php';
include 'user.php';
$mysqli = connect_db();
......@@ -43,7 +44,7 @@ list($page, $owner) = page_owner($url);
$user = new User();
$user->SetPermission($page, $owner);
if (!$user->canEditPage) {
echo json_encode(array('error' => 'Permission denied editing page style.'));
echo json_encode(['error' => 'Permission denied editing page style.']);
$mysqli->close();
exit;
}
......@@ -55,7 +56,7 @@ $update_all_pages = false;
if ($user->canEditSite && isset($_POST['updateAllPages'])) {
$update_all_pages = (int)$_POST['updateAllPages'] === 1;
}
$all_pages = $update_all_pages ? all_pages() : array();
$all_pages = $update_all_pages ? all_pages() : [];
foreach ($us_style as $us_selector => $us_rules) {
if (!is_array($us_rules)) continue;
......@@ -112,4 +113,4 @@ else {
}
// Let the client know the action completed.
echo json_encode(array('done' => true));
echo json_encode(['done' => true]);
<?php
// Dobrado Content Management System
// Copyright (C) 2016 Malcolm Blaney
// Copyright (C) 2017 Malcolm Blaney
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
......@@ -26,6 +26,7 @@ if (!preg_match($regex, $file)) exit;
include 'functions/db.php';
include 'functions/permission.php';
include 'config.php';
include 'module.php';
include 'user.php';
$user = new User();
......
<?php
// Dobrado Content Management System
// Copyright (C) 2016 Malcolm Blaney
// Copyright (C) 2017 Malcolm Blaney
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
......@@ -20,7 +20,7 @@ include 'functions/session.php';
if (session_expired()) exit;
if (!isset($_POST['url'])) {
echo json_encode(array('error' => 'url not provided'));
echo json_encode(['error' => 'url not provided']);
exit;
}
......@@ -40,16 +40,16 @@ $user = new User();
$user->SetPermission($page, $owner);
if (!$user->canEditPage) {
$mysqli->close();
return;
exit;
}
// Don't allow guests to publish pages.
if (substr($owner, 0, 5) === 'guest' && strlen($owner) === 20) {
$error = 'Guest accounts are not allowed to publish pages. '.
'Please register your account.';
echo json_encode(array('error' => $error));
echo json_encode(['error' => $error]);
$mysqli->close();
return;
exit;
}
$published = '';
......@@ -115,4 +115,4 @@ if (!$mysqli->query($query)) {
$mysqli->close();
echo json_encode(array('published' => $published));
echo json_encode(['published' => $published]);
<?php
// Dobrado Content Management System
// Copyright (C) 2016 Malcolm Blaney
// Copyright (C) 2017 Malcolm Blaney
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
......@@ -20,7 +20,7 @@ include 'functions/session.php';