change in metadata for Bludit v4.0, plugin for popeye theme updated, refactor
This commit is contained in:
parent
1c49bef304
commit
84baa2c16b
90 changed files with 727 additions and 1593 deletions
2
LICENSE
2
LICENSE
|
@ -1,6 +1,6 @@
|
|||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2015-2020 Diego Najar
|
||||
Copyright (c) 2015-2021 Diego Najar
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
|
|
@ -170,6 +170,11 @@ class Plugin {
|
|||
return $this->getMetadata('email');
|
||||
}
|
||||
|
||||
public function type()
|
||||
{
|
||||
return $this->getMetadata('type');
|
||||
}
|
||||
|
||||
public function website()
|
||||
{
|
||||
return $this->getMetadata('website');
|
||||
|
|
|
@ -1,40 +0,0 @@
|
|||
<?php defined('BLUDIT') or die('Bludit CMS.');
|
||||
|
||||
// ============================================================================
|
||||
// Check role
|
||||
// ============================================================================
|
||||
|
||||
checkRole(array('admin'));
|
||||
|
||||
// ============================================================================
|
||||
// Functions
|
||||
// ============================================================================
|
||||
|
||||
// ============================================================================
|
||||
// Main before POST
|
||||
// ============================================================================
|
||||
|
||||
// ============================================================================
|
||||
// POST Method
|
||||
// ============================================================================
|
||||
|
||||
// ============================================================================
|
||||
// Main after POST
|
||||
// ============================================================================
|
||||
|
||||
activatePlugin('pluginAPI');
|
||||
$apiURL = DOMAIN_BASE.'api/';
|
||||
$pluginAPI = getPlugin('pluginAPI');
|
||||
$apiToken = $pluginAPI->token();
|
||||
$username = $login->username();
|
||||
$admin = new User($username);
|
||||
$authToken = $admin->tokenAuth();
|
||||
$output = array(
|
||||
'apiURL'=>$apiURL,
|
||||
'username'=>$username,
|
||||
'apiToken'=>$apiToken,
|
||||
'authToken'=>$authToken
|
||||
);
|
||||
exit(json_encode($output));
|
||||
|
||||
?>
|
|
@ -17,8 +17,8 @@ checkRole(array('admin'));
|
|||
$plugin = false;
|
||||
$pluginClassName = $layout['parameters'];
|
||||
|
||||
// Check if the plugin exists
|
||||
if (isset($plugins['all'][$pluginClassName])) {
|
||||
// Check if the plugin is installed/activated
|
||||
if (pluginActivated($pluginClassName)) {
|
||||
$plugin = $plugins['all'][$pluginClassName];
|
||||
} else {
|
||||
Redirect::page('plugins');
|
||||
|
|
|
@ -68,7 +68,8 @@ a.nav-link:hover,
|
|||
color: #b3b3b3;
|
||||
}
|
||||
|
||||
.form-control:focus {
|
||||
.form-control:focus,
|
||||
.form-select:focus {
|
||||
background-color: #111111;
|
||||
border-color: #302F33;
|
||||
color: #b3b3b3;
|
||||
|
@ -105,8 +106,9 @@ a.nav-link:hover,
|
|||
}
|
||||
|
||||
.alert-primary {
|
||||
background-color: #97A4B9;
|
||||
border-color: #aebcd2;
|
||||
background-color: #191e27;
|
||||
border-color: #232a35;
|
||||
color: #b3b3b3;
|
||||
}
|
||||
|
||||
.modal-content {
|
||||
|
@ -127,8 +129,14 @@ a.nav-link:hover,
|
|||
.list-group-item {
|
||||
background-color: inherit;
|
||||
color: #b3b3b3;
|
||||
border: 0 none;
|
||||
}
|
||||
|
||||
.list-group-item a {
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.border-top,
|
||||
.border-bottom {
|
||||
border-color: #302F33 !important;
|
||||
}
|
|
@ -1,3 +1,7 @@
|
|||
body {
|
||||
background-color: #f1f1f1;
|
||||
}
|
||||
|
||||
a {
|
||||
color: #555;
|
||||
}
|
||||
|
@ -14,4 +18,19 @@ a.nav-link {
|
|||
.btn-primary-disabled {
|
||||
background-color: #4792ff !important;
|
||||
border-color: #4792ff !important;
|
||||
}
|
||||
}
|
||||
|
||||
.nav-tabs .nav-item.show .nav-link,
|
||||
.nav-tabs .nav-link.active {
|
||||
background-color: #d8d8d8;
|
||||
border-color: #dee2e6;
|
||||
}
|
||||
|
||||
.list-group-item {
|
||||
background-color: inherit;
|
||||
border: 0 none;
|
||||
}
|
||||
|
||||
.list-group-item a {
|
||||
text-decoration: none;
|
||||
}
|
||||
|
|
|
@ -3,5 +3,7 @@
|
|||
// Init scripts for the theme
|
||||
|
||||
// This theme use the API to work
|
||||
activatePlugin('pluginAPI');
|
||||
$plugins['all']['pluginAPI']->newToken();
|
||||
if (!pluginActivated('pluginAPI')) {
|
||||
activatePlugin('pluginAPI');
|
||||
}
|
||||
$plugins['all']['pluginAPI']->newToken();
|
|
@ -15,9 +15,19 @@
|
|||
echo HTML::cssBootstrap();
|
||||
echo HTML::cssBootstrapIcons();
|
||||
echo HTML::css(array(
|
||||
'bludit-bootstrap.css',
|
||||
'bludit.css'
|
||||
'01-bludit.css',
|
||||
'02-bootstrap-hacks.css'
|
||||
), DOMAIN_ADMIN_THEME_CSS);
|
||||
|
||||
if ($site->darkModeAdmin()) {
|
||||
echo HTML::css(array(
|
||||
'99-darkmode.css'
|
||||
), DOMAIN_ADMIN_THEME_CSS);
|
||||
} else {
|
||||
echo HTML::css(array(
|
||||
'99-lightmode.css'
|
||||
), DOMAIN_ADMIN_THEME_CSS);
|
||||
}
|
||||
?>
|
||||
|
||||
<!-- Javascript -->
|
||||
|
|
|
@ -34,37 +34,37 @@ echo '
|
|||
';
|
||||
|
||||
echo '<tr>';
|
||||
echo '<td>Bludit Edition</td>';
|
||||
echo '<td class="pt-4 pb-4">Bludit Edition</td>';
|
||||
if (defined('BLUDIT_PRO')) {
|
||||
echo '<td>PRO - '.$L->g('Thanks for supporting Bludit').' <span class="bi-heart" style="color: #ffc107"></span></td>';
|
||||
echo '<td class="pt-4 pb-4">PRO - '.$L->g('Thanks for supporting Bludit').' <span class="bi-heart" style="color: #ffc107"></span></td>';
|
||||
} else {
|
||||
echo '<td>Standard - <a target="_blank" href="https://pro.bludit.com">'.$L->g('Upgrade to Bludit PRO').'</a></td>';
|
||||
echo '<td class="pt-4 pb-4">Standard - <a target="_blank" href="https://pro.bludit.com">'.$L->g('Upgrade to Bludit PRO').'</a></td>';
|
||||
}
|
||||
echo '</tr>';
|
||||
|
||||
echo '<tr>';
|
||||
echo '<td>Bludit Version</td>';
|
||||
echo '<td>'.BLUDIT_VERSION.'</td>';
|
||||
echo '<td class="pt-4 pb-4">Bludit Version</td>';
|
||||
echo '<td class="pt-4 pb-4">'.BLUDIT_VERSION.'</td>';
|
||||
echo '</tr>';
|
||||
|
||||
echo '<tr>';
|
||||
echo '<td>Bludit Codename</td>';
|
||||
echo '<td>'.BLUDIT_CODENAME.'</td>';
|
||||
echo '<td class="pt-4 pb-4">Bludit Codename</td>';
|
||||
echo '<td class="pt-4 pb-4">'.BLUDIT_CODENAME.'</td>';
|
||||
echo '</tr>';
|
||||
|
||||
echo '<tr>';
|
||||
echo '<td>Bludit Build Number</td>';
|
||||
echo '<td>'.BLUDIT_BUILD.'</td>';
|
||||
echo '<td class="pt-4 pb-4">Bludit Build Number</td>';
|
||||
echo '<td class="pt-4 pb-4">'.BLUDIT_BUILD.'</td>';
|
||||
echo '</tr>';
|
||||
|
||||
echo '<tr>';
|
||||
echo '<td>Disk usage</td>';
|
||||
echo '<td>'.Filesystem::bytesToHumanFileSize(Filesystem::getSize(PATH_ROOT)).'</td>';
|
||||
echo '<td class="pt-4 pb-4">Disk usage</td>';
|
||||
echo '<td class="pt-4 pb-4">'.Filesystem::bytesToHumanFileSize(Filesystem::getSize(PATH_ROOT)).'</td>';
|
||||
echo '</tr>';
|
||||
|
||||
echo '<tr>';
|
||||
echo '<td><a href="'.HTML_PATH_ADMIN_ROOT.'developers'.'">Bludit Developers</a></td>';
|
||||
echo '<td></td>';
|
||||
echo '<td class="pt-4 pb-4"><a href="'.HTML_PATH_ADMIN_ROOT.'developers'.'">Bludit Developers</a></td>';
|
||||
echo '<td class="pt-4 pb-4"></td>';
|
||||
echo '</tr>';
|
||||
|
||||
echo '
|
||||
|
|
|
@ -70,7 +70,19 @@
|
|||
var key = $(this).attr('name');
|
||||
var value = $(this).val();
|
||||
args[key] = value;
|
||||
})
|
||||
});
|
||||
|
||||
$('select[data-save="true"]').each(function() {
|
||||
var key = $(this).attr('name');
|
||||
var value = $(this).val();
|
||||
args[key] = value;
|
||||
});
|
||||
|
||||
$('textarea[data-save="true"]').each(function() {
|
||||
var key = $(this).attr('name');
|
||||
var value = $(this).val();
|
||||
args[key] = value;
|
||||
});
|
||||
|
||||
api.editUser(args).then(function(response) {
|
||||
if (response.status == 0) {
|
||||
|
@ -299,6 +311,14 @@
|
|||
'value' => $user->lastName(),
|
||||
'data' => array('save' => 'true')
|
||||
));
|
||||
|
||||
echo Bootstrap::formTextarea(array(
|
||||
'name' => 'bio',
|
||||
'label' => $L->g('Bio'),
|
||||
'value' => $user->bio(),
|
||||
'rows' => 4,
|
||||
'data' => array('save' => 'true')
|
||||
));
|
||||
?>
|
||||
</div>
|
||||
<!-- End Tab profile -->
|
||||
|
|
|
@ -256,15 +256,15 @@
|
|||
closeModal('type');
|
||||
|
||||
if (args['type'] == 'draft') {
|
||||
$('#btnCurrenType').html('<i class="bi bi-square-fill"></i><?php $L->p('Draft') ?>');
|
||||
$('#btnCurrenType').html('<i class="bi bi-circle"></i><?php $L->p('Draft') ?>');
|
||||
} else if (args['type'] == 'published') {
|
||||
$('#btnCurrenType').html('<i class="bi bi-check-square-fill"></i><?php $L->p('Published') ?>');
|
||||
$('#btnCurrenType').html('<i class="bi bi-check2-circle"></i><?php $L->p('Published') ?>');
|
||||
} else if (args['type'] == 'unlisted') {
|
||||
$('#btnCurrenType').html('<i class="bi bi-check-square-fill"></i><?php $L->p('Unlisted') ?>');
|
||||
$('#btnCurrenType').html('<i class="bi bi-check2-circle"></i><?php $L->p('Unlisted') ?>');
|
||||
} else if (args['type'] == 'sticky') {
|
||||
$('#btnCurrenType').html('<i class="bi bi-check-square-fill"></i><?php $L->p('Sticky') ?>');
|
||||
$('#btnCurrenType').html('<i class="bi bi-check2-circle"></i><?php $L->p('Sticky') ?>');
|
||||
} else if (args['type'] == 'static') {
|
||||
$('#btnCurrenType').html('<i class="bi bi-check-square-fill"></i><?php $L->p('Static') ?>');
|
||||
$('#btnCurrenType').html('<i class="bi bi-check2-circle"></i><?php $L->p('Static') ?>');
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -544,22 +544,24 @@
|
|||
<div id="editorToolbarLeft">
|
||||
<button id="btnSave" type="button" data-current="saved" class="btn btn-sm btn-primary btn-primary-disabled"><i class="bi bi-save"></i><?php $L->p('Saved') ?></button>
|
||||
<button id="btnPreview" type="button" class="btn btn-sm btn-primary"><i class="bi bi-box-arrow-up-right"></i><?php $L->p('Preview') ?></button>
|
||||
<span id="btnCurrenType" class="ms-1">
|
||||
</div>
|
||||
<div id="editorToolbarRight" class="ms-auto">
|
||||
<span id="btnCurrenType" class="ms-1 text-uppercase">
|
||||
<?php
|
||||
if ($pageKey) {
|
||||
if ($page->draft()) {
|
||||
echo '<i class="bi bi-square-fill"></i><span>' . $L->g('Draft') . '</span>';
|
||||
echo '<i class="bi bi-circle"></i><span>' . $L->g('Draft') . '</span>';
|
||||
} elseif ($page->published()) {
|
||||
echo '<i class="bi bi-check-square-fill"></i><span>' . $L->g('Published') . '</span>';
|
||||
echo '<i class="bi bi-check2-circle"></i><span>' . $L->g('Published') . '</span>';
|
||||
} elseif ($page->sticky()) {
|
||||
echo '<i class="bi bi-check-square-fill"></i><span>' . $L->g('Sticky') . '</span>';
|
||||
echo '<i class="bi bi-check2-circle"></i><span>' . $L->g('Sticky') . '</span>';
|
||||
} elseif ($page->isStatic()) {
|
||||
echo '<i class="bi bi-check-square-fill"></i><span>' . $L->g('Static') . '</span>';
|
||||
echo '<i class="bi bi-check2-circle"></i><span>' . $L->g('Static') . '</span>';
|
||||
} elseif ($page->unlisted()) {
|
||||
echo '<i class="bi bi-check-square-fill"></i><span>' . $L->g('Unlisted') . '</span>';
|
||||
echo '<i class="bi bi-check2-circle"></i><span>' . $L->g('Unlisted') . '</span>';
|
||||
}
|
||||
} else {
|
||||
echo '<i class="bi bi-square-fill"></i><span>' . $L->g('Draft') . '</span>';
|
||||
echo '<i class="bi bi-circle"></i><span>' . $L->g('Draft') . '</span>';
|
||||
}
|
||||
?>
|
||||
</span>
|
||||
|
@ -642,14 +644,14 @@
|
|||
<!-- End Tags -->
|
||||
|
||||
<h6 class="text-uppercase mt-4">More options</h6>
|
||||
<ul class="list-group list-group-flush">
|
||||
<li class="list-group-item p-0 pt-2"><a onclick="fmOpen()" href="#"><i class="bi bi-files"></i>Files & images</a></li>
|
||||
<li class="list-group-item p-0 pt-2"><a onclick="openModal('description')" href="#"><i class="bi bi-info-square"></i>Description</a></li>
|
||||
<li class="list-group-item p-0 pt-2"><a onclick="openModal('date')" href="#"><i class="bi bi-calendar"></i>Publish date</a></li>
|
||||
<li class="list-group-item p-0 pt-2"><a onclick="openModal('friendlyURL')" href="#"><i class="bi bi-link"></i>Change URL</a></li>
|
||||
<li class="list-group-item p-0 pt-2"><a onclick="openModal('type')" href="#"><i class="bi bi-eye"></i>Type</a></li>
|
||||
<li class="list-group-item p-0 pt-2"><a onclick="openModal('seo')" href="#"><i class="bi bi-compass"></i>SEO features</a></li>
|
||||
<li class="list-group-item p-0 pt-2"><a onclick="openModal('parent')" href="#"><i class="bi bi-diagram-2"></i>Parent page</a></li>
|
||||
<ul class="list-group">
|
||||
<li class="list-group-item p-0 pt-3"><a onclick="fmOpen()" href="#"><i class="bi bi-files"></i>Files & images</a></li>
|
||||
<li class="list-group-item p-0 pt-3"><a onclick="openModal('description')" href="#"><i class="bi bi-info-square"></i>Description</a></li>
|
||||
<li class="list-group-item p-0 pt-3"><a onclick="openModal('date')" href="#"><i class="bi bi-calendar"></i>Publish date</a></li>
|
||||
<li class="list-group-item p-0 pt-3"><a onclick="openModal('friendlyURL')" href="#"><i class="bi bi-link"></i>Change URL</a></li>
|
||||
<li class="list-group-item p-0 pt-3"><a onclick="openModal('type')" href="#"><i class="bi bi-eye"></i>Type</a></li>
|
||||
<li class="list-group-item p-0 pt-3"><a onclick="openModal('seo')" href="#"><i class="bi bi-compass"></i>SEO features</a></li>
|
||||
<li class="list-group-item p-0 pt-3"><a onclick="openModal('parent')" href="#"><i class="bi bi-diagram-2"></i>Parent page</a></li>
|
||||
|
||||
</ul>
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
|
||||
echo '<h1 class="text-center fw-normal mb-5">'.$site->title().'</h1>';
|
||||
|
||||
echo Bootstrap::formOpen(array());
|
||||
echo Bootstrap::formOpen(array('name'=>'login'));
|
||||
|
||||
echo Bootstrap::formInputHidden(array(
|
||||
'name'=>'tokenCSRF',
|
||||
|
|
|
@ -109,7 +109,10 @@ foreach ($pluginsInstalled as $plugin) {
|
|||
if (method_exists($plugin, 'form')) {
|
||||
echo '<a class="me-3" href="' . HTML_PATH_ADMIN_ROOT . 'plugins-settings/' . $plugin->className() . '">' . $L->g('Settings') . '</a>';
|
||||
}
|
||||
echo '<span class="link deactivatePlugin" data-class-name="' . $plugin->className() . '">' . $L->g('Deactivate') . '</a>';
|
||||
// You can not disable a plugin for an activated theme
|
||||
if ($plugin->type()!='theme') {
|
||||
echo '<span class="link deactivatePlugin" data-class-name="' . $plugin->className() . '">' . $L->g('Deactivate') . '</a>';
|
||||
}
|
||||
echo '</div>';
|
||||
echo '</td>';
|
||||
|
||||
|
|
|
@ -238,15 +238,6 @@
|
|||
'data' => array('save' => 'true')
|
||||
));
|
||||
|
||||
echo Bootstrap::formSelect(array(
|
||||
'name' => 'darkModeWebsite',
|
||||
'label' => $L->g('Website'),
|
||||
'options' => array('true' => $L->g('Enabled'), 'false' => $L->g('Disabled')),
|
||||
'selected' => ($site->darkModeWebsite() ? 'true' : 'false'),
|
||||
'tip' => $L->g('Enable dark mode for the website. The theme has to support this feature.'),
|
||||
'data' => array('save' => 'true')
|
||||
));
|
||||
|
||||
echo Bootstrap::formTitle(array('title' => $L->g('Autosave')));
|
||||
|
||||
echo Bootstrap::formInputText(array(
|
||||
|
|
|
@ -43,14 +43,18 @@ echo '
|
|||
|
||||
foreach ($themes as $theme) {
|
||||
echo '
|
||||
<tr '.($theme['dirname']==$site->theme()?'class="bg-info"':'').'>
|
||||
<tr>
|
||||
<td class="align-middle pt-4 pb-4">
|
||||
<div>'.$theme['name'].'</div>
|
||||
<div>'.$theme['name'].($theme['dirname']==$site->theme()?'<span class="badge bg-primary ms-2">Active</span>':'').'</div>
|
||||
<div class="mt-1">
|
||||
';
|
||||
|
||||
if ($theme['dirname']!=$site->theme()) {
|
||||
echo '<a href="'.HTML_PATH_ADMIN_ROOT.'install-theme/'.$theme['dirname'].'">'.$L->g('Activate').'</a>';
|
||||
} else {
|
||||
if (isset($theme['plugin'])) {
|
||||
echo '<a href="' . HTML_PATH_ADMIN_ROOT . 'plugins-settings/' . $theme['plugin'] . '">' . $L->g('Settings') . '</a>';
|
||||
}
|
||||
}
|
||||
|
||||
echo '
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
<?php defined('BLUDIT') or die('Bludit CMS.');
|
||||
|
||||
// Bludit version
|
||||
define('BLUDIT_VERSION', '3.13.1');
|
||||
define('BLUDIT_CODENAME', 'Edi');
|
||||
define('BLUDIT_RELEASE_DATE', '2020-07-28');
|
||||
define('BLUDIT_BUILD', '20200728');
|
||||
define('BLUDIT_VERSION', '4.0.0');
|
||||
define('BLUDIT_CODENAME', '');
|
||||
define('BLUDIT_RELEASE_DATE', '2021-05-23');
|
||||
define('BLUDIT_BUILD', '20210523');
|
||||
|
||||
// Debug mode
|
||||
// Change to FALSE, for prevent warning or errors on browser
|
||||
|
@ -31,23 +31,24 @@ define('PATH_CONTENT', PATH_ROOT.'bl-content'.DS);
|
|||
define('PATH_ABSTRACT', PATH_KERNEL.'abstract'.DS);
|
||||
define('PATH_RULES', PATH_KERNEL.'boot'.DS.'rules'.DS);
|
||||
define('PATH_HELPERS', PATH_KERNEL.'helpers'.DS);
|
||||
define('PATH_AJAX', PATH_KERNEL.'ajax'.DS);
|
||||
define('PATH_AJAX', PATH_KERNEL.'ajax'.DS);
|
||||
define('PATH_CORE_JS', PATH_KERNEL.'js'.DS);
|
||||
|
||||
define('PATH_PAGES', PATH_CONTENT.'pages'.DS);
|
||||
define('PATH_DATABASES', PATH_CONTENT.'databases'.DS);
|
||||
define('PATH_PLUGINS_DATABASES', PATH_CONTENT.'databases'.DS.'plugins'.DS);
|
||||
define('PATH_TMP', PATH_CONTENT.'tmp'.DS);
|
||||
define('PATH_PLUGINS_DATABASES',PATH_CONTENT.'databases'.DS.'plugins'.DS);
|
||||
define('PATH_THEMES_DATABASES', PATH_CONTENT.'databases'.DS.'themes'.DS);
|
||||
define('PATH_TMP', PATH_CONTENT.'tmp'.DS);
|
||||
define('PATH_UPLOADS', PATH_CONTENT.'uploads'.DS);
|
||||
define('PATH_WORKSPACES', PATH_CONTENT.'workspaces'.DS);
|
||||
|
||||
define('PATH_UPLOADS_PAGES', PATH_UPLOADS.'pages'.DS);
|
||||
define('PATH_UPLOADS_PROFILES', PATH_UPLOADS.'profiles'.DS);
|
||||
define('PATH_UPLOADS_THUMBNAILS', PATH_UPLOADS.'thumbnails'.DS);
|
||||
define('PATH_UPLOADS_PAGES', PATH_UPLOADS.'pages'.DS);
|
||||
define('PATH_UPLOADS_PROFILES', PATH_UPLOADS.'profiles'.DS);
|
||||
define('PATH_UPLOADS_THUMBNAILS',PATH_UPLOADS.'thumbnails'.DS);
|
||||
|
||||
define('PATH_ADMIN', PATH_KERNEL.'admin'.DS);
|
||||
define('PATH_ADMIN_THEMES', PATH_ADMIN.'themes'.DS);
|
||||
define('PATH_ADMIN_CONTROLLERS', PATH_ADMIN.'controllers'.DS);
|
||||
define('PATH_ADMIN_CONTROLLERS',PATH_ADMIN.'controllers'.DS);
|
||||
define('PATH_ADMIN_VIEWS', PATH_ADMIN.'views'.DS);
|
||||
|
||||
define('DEBUG_FILE', PATH_CONTENT.'debug.txt');
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
// ============================================================================
|
||||
// Variables
|
||||
// ============================================================================
|
||||
$theme = getPlugin($site->theme()); // Returns plugin object or False
|
||||
|
||||
// ============================================================================
|
||||
// Functions
|
||||
|
|
|
@ -622,7 +622,7 @@ function activatePlugin($className) {
|
|||
return true;
|
||||
}
|
||||
|
||||
Log::set(__FUNCTION__.LOG_SEP.'Not was possible install the plugin.', LOG_TYPE_ERROR);
|
||||
Log::set(__FUNCTION__.LOG_SEP.'It was not possible to install the plugin:'.$className, LOG_TYPE_ERROR);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -650,7 +650,7 @@ function deactivatePlugin($className) {
|
|||
return true;
|
||||
}
|
||||
|
||||
Log::set(__FUNCTION__.LOG_SEP.'Not was possible uninstall the plugin.', LOG_TYPE_ERROR);
|
||||
Log::set(__FUNCTION__.LOG_SEP.'It was not possible to uninstall the plugin:'.$className, LOG_TYPE_ERROR);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -1130,13 +1130,20 @@ function getTag($key) {
|
|||
function activateTheme($themeDirectory) {
|
||||
global $site;
|
||||
global $syslog;
|
||||
global $L, $language;
|
||||
global $L;
|
||||
|
||||
if (Sanitize::pathFile(PATH_THEMES.$themeDirectory)) {
|
||||
// Disable current theme
|
||||
$currentTheme = $site->theme();
|
||||
deactivatePlugin($currentTheme);
|
||||
|
||||
// Install new theme
|
||||
if (Filesystem::fileExists(PATH_THEMES.$themeDirectory.DS.'install.php')) {
|
||||
include_once(PATH_THEMES.$themeDirectory.DS.'install.php');
|
||||
}
|
||||
|
||||
activatePlugin($themeDirectory);
|
||||
|
||||
$site->set(array('theme'=>$themeDirectory));
|
||||
|
||||
$syslog->add(array(
|
||||
|
|
|
@ -121,11 +121,20 @@ EOF;
|
|||
$class = $class.' '.$args['class'];
|
||||
}
|
||||
|
||||
$data = 'data-current-value="'.$value.'"';
|
||||
if (isset($args['data'])) {
|
||||
if (is_array($args['data'])) {
|
||||
foreach ($args['data'] as $x => $y) {
|
||||
$data .= ' data-'.$x.' = "'.$y.'"';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return <<<EOF
|
||||
<div class="mb-3 row">
|
||||
$label
|
||||
<div class="col-sm-10">
|
||||
<textarea class="$class" id="$id" name="$name" rows="$rows" placeholder="$placeholder" spellcheck="false">$value</textarea>
|
||||
<textarea class="$class" id="$id" $data name="$name" rows="$rows" placeholder="$placeholder" spellcheck="false">$value</textarea>
|
||||
$tip
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -51,8 +51,7 @@ class Site extends dbJSON {
|
|||
'logo'=> '',
|
||||
'markdownParser'=> true,
|
||||
'customFields'=> '{}',
|
||||
'darkModeAdmin'=> false,
|
||||
'darkModeWebsite'=> false
|
||||
'darkModeAdmin'=> false
|
||||
);
|
||||
|
||||
function __construct()
|
||||
|
@ -158,11 +157,6 @@ class Site extends dbJSON {
|
|||
return $this->getField('darkModeAdmin');
|
||||
}
|
||||
|
||||
public function darkModeWebsite()
|
||||
{
|
||||
return $this->getField('darkModeWebsite');
|
||||
}
|
||||
|
||||
public function twitter()
|
||||
{
|
||||
return $this->getField('twitter');
|
||||
|
|
|
@ -49,9 +49,9 @@ class User {
|
|||
return $this->getValue('username');
|
||||
}
|
||||
|
||||
public function description()
|
||||
public function bio()
|
||||
{
|
||||
return $this->getValue('description');
|
||||
return $this->getValue('bio');
|
||||
}
|
||||
|
||||
public function nickname()
|
||||
|
@ -180,7 +180,7 @@ class User {
|
|||
$tmp['firstName'] = $this->firstName();
|
||||
$tmp['lastName'] = $this->lastName();
|
||||
$tmp['nickname'] = $this->nickname();
|
||||
$tmp['description'] = $this->description();
|
||||
$tmp['bio'] = $this->bio();
|
||||
$tmp['youtube'] = $this->youtube();
|
||||
$tmp['twitter'] = $this->twitter();
|
||||
$tmp['facebook'] = $this->facebook();
|
||||
|
|
|
@ -6,7 +6,7 @@ class Users extends dbJSON {
|
|||
'firstName'=>'',
|
||||
'lastName'=>'',
|
||||
'nickname'=>'',
|
||||
'description'=>'',
|
||||
'bio'=>'',
|
||||
'role'=>'author', // admin, editor, author
|
||||
'password'=>'',
|
||||
'salt'=>'!Pink Floyd!Welcome to the machine!',
|
||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -2,9 +2,9 @@
|
|||
"author": "Bludit",
|
||||
"email": "",
|
||||
"website": "https://plugins.bludit.com",
|
||||
"version": "3.13.1",
|
||||
"releaseDate": "2020-07-28",
|
||||
"version": "4.0.0",
|
||||
"releaseDate": "2021-05-23",
|
||||
"license": "MIT",
|
||||
"compatible": "3.13.1",
|
||||
"compatible": "4.0.0",
|
||||
"notes": ""
|
||||
}
|
|
@ -2,9 +2,9 @@
|
|||
"author": "Bludit",
|
||||
"email": "",
|
||||
"website": "https://plugins.bludit.com",
|
||||
"version": "3.13.1",
|
||||
"releaseDate": "2020-07-28",
|
||||
"version": "4.0.0",
|
||||
"releaseDate": "2021-05-23",
|
||||
"license": "MIT",
|
||||
"compatible": "3.13.1",
|
||||
"compatible": "4.0.0",
|
||||
"notes": ""
|
||||
}
|
|
@ -1,35 +0,0 @@
|
|||
jQuery(document).ready(function($) {
|
||||
$('#backupFile').change(function() {
|
||||
var file = this.files.length >= 1? this.files[0]: null;
|
||||
if (file === null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Build Form Data
|
||||
var url = $('#jsform').attr("action") || window.location.href;
|
||||
var form = new FormData();
|
||||
form.append("tokenCSRF", $('[name="tokenCSRF"]').val());
|
||||
form.append("backupFile", file);
|
||||
|
||||
// Apply Form
|
||||
$.ajax({
|
||||
url: url,
|
||||
data: form,
|
||||
type: "POST",
|
||||
dataType: "json",
|
||||
mimeType: "multipart/form-data",
|
||||
contentType: false,
|
||||
processData: false,
|
||||
error: function (jqXHR, status, error) {
|
||||
var data = jqXHR.responseJSON;
|
||||
var alert = $("<div></div>").addClass("alert alert-danger").text(data.message);
|
||||
|
||||
$("#jsform .alert:not(.alert-primary)").remove();
|
||||
$("#jstokenCSRF").after(alert);
|
||||
},
|
||||
success: function (data, status, jqXHR) {
|
||||
window.location.reload();
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
|
@ -1,11 +0,0 @@
|
|||
{
|
||||
"create-backup": "Opret sikkerhedskopi",
|
||||
"delete-backup": "Slet sikkerhedskopi",
|
||||
"download": "Download",
|
||||
"plugin-data": {
|
||||
"description": "Den enkle måde at tage backup af din Bludit installation på.",
|
||||
"name": "Backup"
|
||||
},
|
||||
"restore-backup": "Gendan sikkerhedskopi",
|
||||
"there-are-no-backups-for-the-moment": "Der er ingen sikkerhedskopier i øjeblikket"
|
||||
}
|
|
@ -1,25 +0,0 @@
|
|||
{
|
||||
"plugin-data":
|
||||
{
|
||||
"name": "Backup",
|
||||
"description": "Einfach Backups erstellen und wieder einspielen."
|
||||
},
|
||||
"create-backup": "Backup erstellen",
|
||||
"upload-backup": "Backup hochladen",
|
||||
"download": "Backup herunterladen",
|
||||
"restore-backup": "Backup wiederherstellen",
|
||||
"delete-backup": "Backup löschen",
|
||||
"there-are-no-backups-for-the-moment": "Es gibt keine Backups.",
|
||||
"you-do-not-have-sufficient-permissions": "Du hast nicht die notwendigen Berechtigungen",
|
||||
"the-backup-was-created-successfully": "Das Backup wurde erfolgreich erstellt.",
|
||||
"the-backup-file-could-not-be-created": "Das Backup konnte nicht erstellt werden.",
|
||||
"the-backup-'%s'-could-be-restored-successfully": "Das Backup '%s' konnte erfolgreich wiederhergestellt werden.",
|
||||
"the-backup-'%s'-could-not-be-restored": "Das Backup '%s' konnte nicht wiederhergestellt werden.",
|
||||
"the-backup-'%s'-could-be-deleted-successfully": "Das Backup '%s' konnte erfolgreich gelöscht werden.",
|
||||
"the-backup-'%s'-could-not-be-deleted": "Das Backup '%s' konnte nicht gelöscht werden.",
|
||||
"the-passed-file-is-not-a-valid-zip-archive": "Die angegebene Datei ist kein gültiges ZIP Archiv.",
|
||||
"the-passed-file-does-not-end-with-zip": "Die angegebene Datei endet nicht mit .zip.",
|
||||
"the-passed-file-could-not-be-validated": "Die angegebene Datei konnte nicht geprüft werden.",
|
||||
"the-passed-file-is-not-a-valid-backup-archive": "Die angegebene Datei ist kein gültiges Backup Archiv.",
|
||||
"the-backup-file-could-be-uploaded-successfully": "Die Backup Datei konnte erfolgreich hochgeladen werden."
|
||||
}
|
|
@ -1,25 +0,0 @@
|
|||
{
|
||||
"plugin-data":
|
||||
{
|
||||
"name": "Backup",
|
||||
"description": "Einfach Backups erstellen und wieder einspielen."
|
||||
},
|
||||
"create-backup": "Backup erstellen",
|
||||
"upload-backup": "Backup hochladen",
|
||||
"download": "Backup herunterladen",
|
||||
"restore-backup": "Backup wiederherstellen",
|
||||
"delete-backup": "Backup löschen",
|
||||
"there-are-no-backups-for-the-moment": "Es gibt keine Backups.",
|
||||
"you-do-not-have-sufficient-permissions": "Du hast nicht die notwendigen Berechtigungen",
|
||||
"the-backup-was-created-successfully": "Das Backup wurde erfolgreich erstellt.",
|
||||
"the-backup-file-could-not-be-created": "Das Backup konnte nicht erstellt werden.",
|
||||
"the-backup-'%s'-could-be-restored-successfully": "Das Backup '%s' konnte erfolgreich wiederhergestellt werden.",
|
||||
"the-backup-'%s'-could-not-be-restored": "Das Backup '%s' konnte nicht wiederhergestellt werden.",
|
||||
"the-backup-'%s'-could-be-deleted-successfully": "Das Backup '%s' konnte erfolgreich gelöscht werden.",
|
||||
"the-backup-'%s'-could-not-be-deleted": "Das Backup '%s' konnte nicht gelöscht werden.",
|
||||
"the-passed-file-is-not-a-valid-zip-archive": "Die angegebene Datei ist kein gültiges ZIP Archiv.",
|
||||
"the-passed-file-does-not-end-with-zip": "Die angegebene Datei endet nicht mit .zip.",
|
||||
"the-passed-file-could-not-be-validated": "Die angegebene Datei konnte nicht geprüft werden.",
|
||||
"the-passed-file-is-not-a-valid-backup-archive": "Die angegebene Datei ist kein gültiges Backup Archiv.",
|
||||
"the-backup-file-could-be-uploaded-successfully": "Die Backup Datei konnte erfolgreich hochgeladen werden."
|
||||
}
|
|
@ -1,25 +0,0 @@
|
|||
{
|
||||
"plugin-data":
|
||||
{
|
||||
"name": "Backup",
|
||||
"description": "Einfach Backups erstellen und wieder einspielen."
|
||||
},
|
||||
"create-backup": "Backup erstellen",
|
||||
"upload-backup": "Backup hochladen",
|
||||
"download": "Backup herunterladen",
|
||||
"restore-backup": "Backup wiederherstellen",
|
||||
"delete-backup": "Backup löschen",
|
||||
"there-are-no-backups-for-the-moment": "Es gibt keine Backups.",
|
||||
"you-do-not-have-sufficient-permissions": "Du hast nicht die notwendigen Berechtigungen",
|
||||
"the-backup-was-created-successfully": "Das Backup wurde erfolgreich erstellt.",
|
||||
"the-backup-file-could-not-be-created": "Das Backup konnte nicht erstellt werden.",
|
||||
"the-backup-'%s'-could-be-restored-successfully": "Das Backup '%s' konnte erfolgreich wiederhergestellt werden.",
|
||||
"the-backup-'%s'-could-not-be-restored": "Das Backup '%s' konnte nicht wiederhergestellt werden.",
|
||||
"the-backup-'%s'-could-be-deleted-successfully": "Das Backup '%s' konnte erfolgreich gelöscht werden.",
|
||||
"the-backup-'%s'-could-not-be-deleted": "Das Backup '%s' konnte nicht gelöscht werden.",
|
||||
"the-passed-file-is-not-a-valid-zip-archive": "Die angegebene Datei ist kein gültiges ZIP Archiv.",
|
||||
"the-passed-file-does-not-end-with-zip": "Die angegebene Datei endet nicht mit .zip.",
|
||||
"the-passed-file-could-not-be-validated": "Die angegebene Datei konnte nicht geprüft werden.",
|
||||
"the-passed-file-is-not-a-valid-backup-archive": "Die angegebene Datei ist kein gültiges Backup Archiv.",
|
||||
"the-backup-file-could-be-uploaded-successfully": "Die Backup Datei konnte erfolgreich hochgeladen werden."
|
||||
}
|
|
@ -1,25 +0,0 @@
|
|||
{
|
||||
"plugin-data":
|
||||
{
|
||||
"name": "Backup",
|
||||
"description": "The simple way to backup your Bludit."
|
||||
},
|
||||
"create-backup": "Create Backup",
|
||||
"upload-backup": "Upload Backup",
|
||||
"download": "Download",
|
||||
"restore-backup": "Restore Backup",
|
||||
"delete-backup": "Delete Backup",
|
||||
"there-are-no-backups-for-the-moment": "There are no backups for the moment",
|
||||
"you-do-not-have-sufficient-permissions": "You do not have sufficient permissions",
|
||||
"the-backup-was-created-successfully": "The Backup was created successfully.",
|
||||
"the-backup-file-could-not-be-created": "The Backup file could not be created.",
|
||||
"the-backup-'%s'-could-be-restored-successfully": "The Backup '%s' could be restored successfully.",
|
||||
"the-backup-'%s'-could-not-be-restored": "The Backup '%s' could not be restored.",
|
||||
"the-backup-'%s'-could-be-deleted-successfully": "The Backup '%s' could be deleted successfully.",
|
||||
"the-backup-'%s'-could-not-be-deleted": "The Backup '%s' could not be deleted.",
|
||||
"the-passed-file-is-not-a-valid-zip-archive": "The passed file is not a valid ZIP Archive.",
|
||||
"the-passed-file-does-not-end-with-zip": "The passed file does not ent with .zip.",
|
||||
"the-passed-file-could-not-be-validated": "The passed file could not be validated.",
|
||||
"the-passed-file-is-not-a-valid-backup-archive": "The passed file is not a valid backup archive.",
|
||||
"the-backup-file-could-be-uploaded-successfully": "The backup file could be uploaded successfully."
|
||||
}
|
|
@ -1,12 +0,0 @@
|
|||
{
|
||||
"plugin-data":
|
||||
{
|
||||
"name": "Backup",
|
||||
"description": "La forma mas fácil de hacer un backup."
|
||||
},
|
||||
"create-backup": "Crear Backup",
|
||||
"download": "Descargar",
|
||||
"restore-backup": "Recuperar Backup",
|
||||
"delete-backup": "Eliminar Backup",
|
||||
"there-are-no-backups-for-the-moment": "There are no backups for the moment"
|
||||
}
|
|
@ -1,25 +0,0 @@
|
|||
{
|
||||
"plugin-data":
|
||||
{
|
||||
"name": "پشتیبان گیری",
|
||||
"description": "یک روش ساده برای پشتیبانگیری از بلودیت شما."
|
||||
},
|
||||
"create-backup": "ایجاد پشتیبانی",
|
||||
"upload-backup": "بارگذاری پشتیبانی",
|
||||
"download": "دانلود",
|
||||
"restore-backup": "بازگردانی فایل پشتیبانی",
|
||||
"delete-backup": "حذف فایل پشتیبانی",
|
||||
"there-are-no-backups-for-the-moment": "در این لحظه هیچ نسخه پشتیبانی وجود ندارد",
|
||||
"you-do-not-have-sufficient-permissions": "شما مجوزهای لازم را ندارید",
|
||||
"the-backup-was-created-successfully": "نسخه پشتیبان با موفقیت ایجاد شد.",
|
||||
"the-backup-file-could-not-be-created": "امکان ایجاد فایل پشتیبان وجود ندارد.",
|
||||
"the-backup-'%s'-could-be-restored-successfully": "فایل پشتیبانی '%s' با موفقیت بازیابی شد.",
|
||||
"the-backup-'%s'-could-not-be-restored": "فایل پشتیبانی '%s' نمی تواند بازیابی شود.",
|
||||
"the-backup-'%s'-could-be-deleted-successfully": "فایل پشتیبانی '%s' با موفقیت حذف شد.",
|
||||
"the-backup-'%s'-could-not-be-deleted": "فایل پشتیبانی '%s' نمی تواند حذف شود.",
|
||||
"the-passed-file-is-not-a-valid-zip-archive": "فایل انتخاب شده یک فایل ZIP معتبری نمیباشد.",
|
||||
"the-passed-file-does-not-end-with-zip": "فایل انتخاب شده با پسوند zip تمام نمی شود.",
|
||||
"the-passed-file-could-not-be-validated": "فایل انتخاب شده را نمی توان اعتبارسنجی کرد.",
|
||||
"the-passed-file-is-not-a-valid-backup-archive": "فایل انتخاب شده یک فایل معتبر نسخه پشتیبان نمی باشد.",
|
||||
"the-backup-file-could-be-uploaded-successfully": "فایل پشتیبانی با موفقیت آپلود شد."
|
||||
}
|
|
@ -1,12 +0,0 @@
|
|||
{
|
||||
"plugin-data":
|
||||
{
|
||||
"name": "Sauvegarde",
|
||||
"description": "Un moyen simple de sauvegarder votre Bludit."
|
||||
},
|
||||
"create-backup": "Créer une sauvegarde",
|
||||
"download": "Télécharger",
|
||||
"restore-backup": "Restaurer la sauvegarde",
|
||||
"delete-backup": "Supprimer la sauvegarde",
|
||||
"there-are-no-backups-for-the-moment": "There are no backups for the moment"
|
||||
}
|
|
@ -1,12 +0,0 @@
|
|||
{
|
||||
"plugin-data":
|
||||
{
|
||||
"name": "Backup",
|
||||
"description": "Il modo semplice per fare il backup di Bludit."
|
||||
},
|
||||
"create-backup": "Crea Backup",
|
||||
"download": "Scarica",
|
||||
"restore-backup": "Ripristina Backup",
|
||||
"delete-backup": "Elimina Backup",
|
||||
"there-are-no-backups-for-the-moment": "Non ci sono backup al momento"
|
||||
}
|
|
@ -1,12 +0,0 @@
|
|||
{
|
||||
"plugin-data":
|
||||
{
|
||||
"name": "Backup",
|
||||
"description": "Bluditを簡単にバックアップします。"
|
||||
},
|
||||
"create-backup": "バックアップを作成",
|
||||
"download": "ダウンロード",
|
||||
"restore-backup": "バックアップをリストア",
|
||||
"delete-backup": "バックアップを削除",
|
||||
"there-are-no-backups-for-the-moment": "現在、バックアップはありません"
|
||||
}
|
|
@ -1,12 +0,0 @@
|
|||
{
|
||||
"plugin-data":
|
||||
{
|
||||
"name": "Backup",
|
||||
"description": "Eenvoudige manier om backups van Bludit-gegevens te maken."
|
||||
},
|
||||
"create-backup": "Backup maken",
|
||||
"download": "Downloaden",
|
||||
"restore-backup": "Herstellen",
|
||||
"delete-backup": "Verwijderen",
|
||||
"there-are-no-backups-for-the-moment": "Er zijn geen backups."
|
||||
}
|
|
@ -1,12 +0,0 @@
|
|||
{
|
||||
"plugin-data":
|
||||
{
|
||||
"name": "Резервные копии",
|
||||
"description": "Самый простой способ создать резервную копию вашего сайта."
|
||||
},
|
||||
"create-backup": "Создать резервную копию",
|
||||
"download": "Загрузить",
|
||||
"restore-backup": "Восстановление из резервной копии",
|
||||
"delete-backup": "Удалить резервную копию",
|
||||
"there-are-no-backups-for-the-moment": "На данный момент резервных копий нет"
|
||||
}
|
|
@ -1,12 +0,0 @@
|
|||
{
|
||||
"plugin-data":
|
||||
{
|
||||
"name": "Yedekleme",
|
||||
"description": "Yedek oluşturmak için en kolay yol."
|
||||
},
|
||||
"create-backup": "Yedek oluştur",
|
||||
"download": "İndir",
|
||||
"restore-backup": "Geri yükle",
|
||||
"delete-backup": "Yedeklemeyi sil",
|
||||
"there-are-no-backups-for-the-moment": "Şu an için yedek yok"
|
||||
}
|
|
@ -1,10 +0,0 @@
|
|||
{
|
||||
"author": "Bludit",
|
||||
"email": "",
|
||||
"website": "https://plugins.bludit.com",
|
||||
"version": "3.13.1",
|
||||
"releaseDate": "2020-07-28",
|
||||
"license": "MIT",
|
||||
"compatible": "3.13.1",
|
||||
"notes": ""
|
||||
}
|
|
@ -1,344 +0,0 @@
|
|||
<?php
|
||||
|
||||
class pluginBackup extends Plugin {
|
||||
|
||||
// Directories to backup
|
||||
private $directoriesToBackup = array(
|
||||
PATH_PAGES,
|
||||
PATH_DATABASES,
|
||||
PATH_UPLOADS
|
||||
);
|
||||
|
||||
// This variable define if the extension zip is loaded
|
||||
private $zip = false;
|
||||
|
||||
// The last request status
|
||||
private $lastStatus = null;
|
||||
|
||||
// The last request message
|
||||
private $lastMessage = null;
|
||||
|
||||
public function init()
|
||||
{
|
||||
// Disable default form buttons (Save and Cancel)
|
||||
$this->formButtons = false;
|
||||
|
||||
// Check for zip extension installed
|
||||
$this->zip = extension_loaded('zip');
|
||||
|
||||
// Get Last Message
|
||||
if (empty($_POST) && !empty(Session::get("BACKUP-MESSAGE"))) {
|
||||
$this->lastStatus = Session::get("BACKUP-STATUS");
|
||||
$this->lastMessage = Session::get("BACKUP-MESSAGE");
|
||||
unset($_SESSION["s_BACKUP-STATUS"]);
|
||||
unset($_SESSION["s_BACKUP-MESSAGE"]);
|
||||
}
|
||||
}
|
||||
|
||||
protected function response($status, $message)
|
||||
{
|
||||
// Return JSON object for AJAX requests
|
||||
if (isset($_SERVER['HTTP_X_REQUESTED_WITH']) && strcasecmp($_SERVER['HTTP_X_REQUESTED_WITH'], "xmlhttprequest") === 0) {
|
||||
$http = array(
|
||||
200 => "200 OK",
|
||||
400 => "400 Bad Request",
|
||||
415 => "415 Unsupported Media Type"
|
||||
);
|
||||
header("HTTP/1.1 " . $http[$status]);
|
||||
print(json_encode(array(
|
||||
"status" => $status < 400,
|
||||
"message" => $message
|
||||
)));
|
||||
die();
|
||||
}
|
||||
|
||||
// Store in Session
|
||||
Session::set("BACKUP-STATUS", $status < 400);
|
||||
Session::set("BACKUP-MESSAGE", $message);
|
||||
return $status < 400;
|
||||
}
|
||||
|
||||
public function post()
|
||||
{
|
||||
if (isset($_POST['createBackup'])) {
|
||||
return $this->createBackup();
|
||||
} elseif (isset($_POST['restoreBackup'])) {
|
||||
return $this->restoreBackup($_POST['restoreBackup']);
|
||||
} elseif (isset($_POST['deleteBackup'])) {
|
||||
return $this->deleteBackup($_POST['deleteBackup']);
|
||||
}
|
||||
|
||||
if (isset($_FILES['backupFile'])) {
|
||||
return $this->uploadBackup($_FILES['backupFile']);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public function adminHead()
|
||||
{
|
||||
global $url;
|
||||
|
||||
if ($url->slug() !== "configure-plugin/pluginBackup") {
|
||||
return false;
|
||||
}
|
||||
|
||||
$html = $this->includeJS('backup.js');
|
||||
|
||||
return $html;
|
||||
}
|
||||
|
||||
public function adminSidebar()
|
||||
{
|
||||
global $login;
|
||||
if ($login->role() === 'admin') {
|
||||
$backups = $this->backupList();
|
||||
return '<a class="nav-link" href="'.HTML_PATH_ADMIN_ROOT.'configure-plugin/'.$this->className().'">Backups <span class="badge badge-primary badge-pill">'.count($backups).'</span></a>';
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
||||
public function form()
|
||||
{
|
||||
global $L;
|
||||
|
||||
$backups = $this->backupList();
|
||||
|
||||
$html = '';
|
||||
if (empty($backups)) {
|
||||
$html .= '<div class="alert alert-primary" role="alert">';
|
||||
$html .= $L->get('There are no backups for the moment');
|
||||
$html .= '</div>';
|
||||
}
|
||||
|
||||
if($this->lastStatus !== null) {
|
||||
$html .= '<div class="alert alert-' . ($this->lastStatus? "success": "danger") . '" role="alert">';
|
||||
$html .= $this->lastMessage;
|
||||
$html .= '</div>';
|
||||
}
|
||||
|
||||
$html .= '<div class="row">';
|
||||
$html .= '<div class="col text-start">';
|
||||
$html .= '<button name="createBackup" value="true" class="btn btn-primary" type="submit"><span class="bi-play-circle"></span> '.$L->get('create-backup').'</button>';
|
||||
$html .= '</div>';
|
||||
$html .= '<div class="col-5 text-end">';
|
||||
if ($this->zip) {
|
||||
$html .= '<input id="backupFile" type="file" name="backupFile" value="" style="position:absolute;top:-500em;" />';
|
||||
$html .= '<label for="backupFile" value="true" class="btn btn-light d-inline-block" type="submit" style="margin-top:0 !important;"><span class="bi-upload"></span> '.$L->get('upload-backup').'</label>';
|
||||
}
|
||||
$html .= '</div>';
|
||||
$html .= '</div>';
|
||||
$html .= '<hr>';
|
||||
|
||||
foreach ($backups as $backup) {
|
||||
$filename = pathinfo($backup,PATHINFO_FILENAME);
|
||||
$basename = pathinfo($backup,PATHINFO_BASENAME);
|
||||
|
||||
// Format Title
|
||||
list($name, $count) = array_pad(explode(".", $filename, 2), 2, 0);
|
||||
if (($temp = Date::format($name, BACKUP_DATE_FORMAT, 'F j, Y, g:i a')) !== false) {
|
||||
$name = $temp;
|
||||
}
|
||||
|
||||
$html .= '<div>';
|
||||
$html .= '<h4 class="fw-normal">'.$name.($count > 0? " ($count)": "").'</h4>';
|
||||
// Allow download if a zip file
|
||||
if ($this->zip) {
|
||||
$html .= '<a class="btn btn-outline-secondary btn-sm me-1 mt-1" href="'.DOMAIN_BASE.'plugin-backup-download?file='.$filename.'.zip"><span class="bi-download"></span> '.$L->get('download').'</a>';
|
||||
}
|
||||
$html .= '<button name="restoreBackup" value="'.$filename.'" class="btn btn-outline-secondary btn-sm me-1 mt-1" type="submit"><span class="bi-rotate-left"></span> '.$L->get('restore-backup').'</button>';
|
||||
$html .= '<button name="deleteBackup" value="'.$filename.'" class="btn btn-outline-danger btn-sm me-1 mt-1" type="submit"><span class="bi-trash"></span> '.$L->get('delete-backup').'</button>';
|
||||
$html .= '</div>';
|
||||
$html .= '<hr>';
|
||||
}
|
||||
return $html;
|
||||
}
|
||||
|
||||
/**
|
||||
* Downloading Backups is not allowed by default server config
|
||||
* This webhook is to allow downloads for admins
|
||||
* Webhook: plugin-backup-download?file={backup-name.zip}
|
||||
*/
|
||||
public function beforeAll()
|
||||
{
|
||||
global $L;
|
||||
$webhook = 'plugin-backup-download';
|
||||
if ($this->webhook($webhook)) {
|
||||
if (!empty($_GET['file'])) {
|
||||
$login = new Login();
|
||||
if ($login->role() === 'admin') {
|
||||
$existingBackups = array_map('basename', glob(PATH_WORKSPACES.'backup/*.zip'));
|
||||
if (in_array($_GET['file'], $existingBackups)) {
|
||||
downloadRestrictedFile(PATH_WORKSPACES.'backup/'.$_GET['file']);
|
||||
}
|
||||
} else {
|
||||
Alert::set($L->g('You do not have sufficient permissions'));
|
||||
Redirect::page('dashboard');
|
||||
}
|
||||
}
|
||||
exit(0);
|
||||
}
|
||||
}
|
||||
|
||||
public function backupList()
|
||||
{
|
||||
if ($this->zip) {
|
||||
$backups = Filesystem::listFiles($this->workspace(), '*', 'zip', true);
|
||||
} else {
|
||||
$backups = Filesystem::listDirectories($this->workspace(), '*', true);
|
||||
}
|
||||
return $backups;
|
||||
}
|
||||
|
||||
public function createBackup()
|
||||
{
|
||||
global $L;
|
||||
|
||||
// Current backup directory
|
||||
$currentDate = Date::current(BACKUP_DATE_FORMAT);
|
||||
$backupDir = $this->workspace().$currentDate;
|
||||
|
||||
// Copy directories to backup directory
|
||||
// $directoriesToBackup is a private variable of this class
|
||||
foreach ($this->directoriesToBackup as $dir) {
|
||||
$destination = $backupDir.DS.basename($dir);
|
||||
Filesystem::copyRecursive($dir, $destination);
|
||||
}
|
||||
|
||||
// Compress backup directory
|
||||
if ($this->zip) {
|
||||
if (Filesystem::zip($backupDir, $backupDir.'.zip')) {
|
||||
Filesystem::deleteRecursive($backupDir);
|
||||
}
|
||||
|
||||
// Add validation file
|
||||
$zip = new ZipArchive();
|
||||
$zip->open($backupDir.'.zip');
|
||||
$zip->addFromString('.BLUDIT_BACKUP', md5_file($backupDir.'.zip'));
|
||||
$zip->close();
|
||||
}
|
||||
|
||||
if (file_exists($backupDir.'.zip')) {
|
||||
return $this->response(200, $L->get("The Backup was created successfully."));
|
||||
}
|
||||
|
||||
return $this->response(400, $L->get("The Backup file could not be created."));
|
||||
}
|
||||
|
||||
public function validateBackup($filename)
|
||||
{
|
||||
$tmp = PATH_TMP.'backup-'.time().'.zip';
|
||||
copy($filename, $tmp);
|
||||
|
||||
// Check Archive
|
||||
$zip = new ZipArchive();
|
||||
if($zip->open($tmp) !== true) {
|
||||
unlink($tmp);
|
||||
return false;
|
||||
}
|
||||
|
||||
// Check Basic Folders
|
||||
if ($zip->addEmptyDir("databases") || $zip->addEmptyDir("pages") || $zip->addEmptyDir("uploads")) {
|
||||
$zip->close();
|
||||
unlink($tmp);
|
||||
return false;
|
||||
}
|
||||
|
||||
// Check Checksum
|
||||
if (($checksum = $zip->getFromName(".BLUDIT_BACKUP")) === false) {
|
||||
$zip->close();
|
||||
unlink($tmp);
|
||||
return false;
|
||||
}
|
||||
$zip->deleteName(".BLUDIT_BACKUP");
|
||||
$zip->close();
|
||||
$check = $checksum === md5_file($tmp);
|
||||
|
||||
// Return
|
||||
unlink($tmp);
|
||||
return $check;
|
||||
}
|
||||
|
||||
public function restoreBackup($filename)
|
||||
{
|
||||
global $L;
|
||||
|
||||
// Remove current files
|
||||
foreach ($this->directoriesToBackup as $dir) {
|
||||
Filesystem::deleteRecursive($dir);
|
||||
}
|
||||
|
||||
// Recover backuped files
|
||||
if ($this->zip) {
|
||||
// Zip format
|
||||
$tmp = $this->workspace().$filename.'.zip';
|
||||
$status = Filesystem::unzip($tmp, PATH_CONTENT);
|
||||
} else {
|
||||
// Directory format
|
||||
$tmp = $this->workspace().$filename;
|
||||
$status = Filesystem::copyRecursive($tmp, PATH_CONTENT);
|
||||
}
|
||||
|
||||
if ($status) {
|
||||
return $this->response(200, sprintf($L->get("The Backup '%s' could be restored successfully."), $filename));
|
||||
}
|
||||
return $this->response(400, sprintf($L->get("The Backup '%s' could not be restored."), $filename));
|
||||
}
|
||||
|
||||
public function deleteBackup($filename)
|
||||
{
|
||||
global $L;
|
||||
|
||||
if ($this->zip) {
|
||||
// Zip format
|
||||
$tmp = $this->workspace().$filename.'.zip';
|
||||
$status = Filesystem::rmfile($tmp);
|
||||
} else {
|
||||
// Directory format
|
||||
$tmp = $this->workspace().$filename;
|
||||
$status = Filesystem::deleteRecursive($tmp);
|
||||
}
|
||||
|
||||
if ($status) {
|
||||
return $this->response(200, sprintf($L->get("The Backup '%s' could be deleted successfully."), $filename));
|
||||
}
|
||||
return $this->response(400, sprintf($L->get("The Backup '%s' could not be deleted."), $filename));
|
||||
}
|
||||
|
||||
public function uploadBackup($backup)
|
||||
{
|
||||
global $L;
|
||||
|
||||
// Check File Type
|
||||
if ($backup["type"] !== "application/zip" && $backup["type"] !== "application/x-zip-compressed") {
|
||||
return $this->response(415, $L->get("The passed file is not a valid ZIP Archive."));
|
||||
}
|
||||
|
||||
// Check File Extension
|
||||
if (stripos($backup["name"], ".zip") !== (strlen($backup["name"]) - 4)) {
|
||||
return $this->response(415, $L->get("The passed file does not end with .zip."));
|
||||
}
|
||||
|
||||
// Check ZIP extension
|
||||
if(!$this->zip) {
|
||||
return $this->response(400, $L->get("The passed file could not be validated."));
|
||||
}
|
||||
|
||||
// Validate Backup ZIP
|
||||
if (!$this->validateBackup($backup["tmp_name"])) {
|
||||
return $this->response(415, $L->get("The passed file is not a valid backup archive."));
|
||||
}
|
||||
|
||||
// File Name
|
||||
$name = $backup["name"];
|
||||
$count = 0;
|
||||
while (file_exists($this->workspace() . $name)) {
|
||||
$name = substr($backup["name"], 0, -4) . "." . ++$count . ".zip";
|
||||
}
|
||||
|
||||
// Move File to Backup Directory
|
||||
Filesystem::mv($backup["tmp_name"], $this->workspace() . $name);
|
||||
return $this->response(200, $L->get("The backup file could be uploaded successfully."));
|
||||
}
|
||||
}
|
|
@ -2,9 +2,9 @@
|
|||
"author": "Bludit",
|
||||
"email": "",
|
||||
"website": "https://plugins.bludit.com",
|
||||
"version": "3.13.1",
|
||||
"releaseDate": "2020-07-28",
|
||||
"version": "4.0.0",
|
||||
"releaseDate": "2021-05-23",
|
||||
"license": "MIT",
|
||||
"compatible": "3.13.1",
|
||||
"compatible": "4.0.0",
|
||||
"notes": ""
|
||||
}
|
|
@ -2,9 +2,9 @@
|
|||
"author": "Bludit",
|
||||
"email": "",
|
||||
"website": "https://plugins.bludit.com",
|
||||
"version": "3.13.1",
|
||||
"releaseDate": "2020-07-28",
|
||||
"version": "4.0.0",
|
||||
"releaseDate": "2021-05-23",
|
||||
"license": "MIT",
|
||||
"compatible": "3.13.1",
|
||||
"compatible": "4.0.0",
|
||||
"notes": ""
|
||||
}
|
|
@ -1,6 +0,0 @@
|
|||
{
|
||||
"plugin-data": {
|
||||
"description": "Definer kode for de brugerdefinerede felter, og fortolk indholdet af siderne.",
|
||||
"name": "Custom fields parser"
|
||||
}
|
||||
}
|
|
@ -1,7 +0,0 @@
|
|||
{
|
||||
"plugin-data":
|
||||
{
|
||||
"name": "Custom fields parser",
|
||||
"description": "Define code for the custom fields and parse the content of the pages."
|
||||
}
|
||||
}
|
|
@ -1,7 +0,0 @@
|
|||
{
|
||||
"plugin-data":
|
||||
{
|
||||
"name": "تحلیلگر کادر سفارشی",
|
||||
"description": "برای کادرهای سفارشی کد تعریف کرده و محتوای صفحات را تحلیل کنید."
|
||||
}
|
||||
}
|
|
@ -1,6 +0,0 @@
|
|||
{
|
||||
"plugin-data": {
|
||||
"name": "Парсер пользовательских полей",
|
||||
"description": "Ищет код пользовательских полей и отпределяет содержимое страниц в соответствии с найденным кодом."
|
||||
}
|
||||
}
|
|
@ -1,10 +0,0 @@
|
|||
{
|
||||
"author": "Bludit",
|
||||
"email": "",
|
||||
"website": "https://plugins.bludit.com",
|
||||
"version": "3.13.1",
|
||||
"releaseDate": "2020-07-28",
|
||||
"license": "MIT",
|
||||
"compatible": "3.13.1",
|
||||
"notes": ""
|
||||
}
|
|
@ -1,71 +0,0 @@
|
|||
<?php
|
||||
|
||||
class pluginCustomFieldsParser extends Plugin {
|
||||
|
||||
public function init()
|
||||
{
|
||||
$this->dbFields = array(
|
||||
'label'=>'Custom fields parser',
|
||||
'jsondb'=>json_encode(array())
|
||||
);
|
||||
}
|
||||
|
||||
public function form()
|
||||
{
|
||||
global $L;
|
||||
global $site;
|
||||
|
||||
$html = '<div class="alert alert-primary" role="alert">';
|
||||
$html .= $this->description();
|
||||
$html .= '</div>';
|
||||
|
||||
$jsondb = $this->getValue('jsondb', false);
|
||||
$database = json_decode($jsondb, true);
|
||||
|
||||
$customFields = $site->customFields();
|
||||
|
||||
foreach ($customFields as $field=>$options) {
|
||||
if ($options['type']=="string") {
|
||||
$html .= '<div>';
|
||||
$html .= '<label>'.$options['label'].'</label>';
|
||||
$html .= '<textarea name="'.$field.'">'.(isset($database[$field])?$database[$field]:'').'</textarea>';
|
||||
$html .= '</div>';
|
||||
}
|
||||
}
|
||||
|
||||
return $html;
|
||||
}
|
||||
|
||||
public function post()
|
||||
{
|
||||
$this->db['jsondb'] = Sanitize::html(json_encode($_POST));
|
||||
return $this->save();
|
||||
}
|
||||
|
||||
public function parse($page)
|
||||
{
|
||||
$jsondb = $this->getValue('jsondb', false);
|
||||
$database = json_decode($jsondb, true);
|
||||
$parsedCode = array();
|
||||
|
||||
foreach ($database as $field=>$code) {
|
||||
$value = $page->custom($field);
|
||||
$parsedCode['{{ '.$field.' }}'] = str_replace('{{ value }}', $value, $code);
|
||||
}
|
||||
|
||||
$content = $page->contentRaw();
|
||||
return str_replace(array_keys($parsedCode), array_values($parsedCode), $content);
|
||||
}
|
||||
|
||||
public function beforeSiteLoad()
|
||||
{
|
||||
if ($GLOBALS['WHERE_AM_I']=='page') {
|
||||
$GLOBALS['page']->setField('content', $this->parse($GLOBALS['page']));
|
||||
} else {
|
||||
foreach ($GLOBALS['content'] as $key=>$page) {
|
||||
$GLOBALS['content'][$key]->setField('content', $this->parse($GLOBALS['content'][$key]));
|
||||
}
|
||||
$GLOBALS['page'] = $GLOBALS['content'][0];
|
||||
}
|
||||
}
|
||||
}
|
|
@ -2,9 +2,9 @@
|
|||
"author": "Bludit",
|
||||
"email": "",
|
||||
"website": "https://plugins.bludit.com",
|
||||
"version": "3.13.1",
|
||||
"releaseDate": "2020-07-28",
|
||||
"version": "4.0.0",
|
||||
"releaseDate": "2021-05-23",
|
||||
"license": "MIT",
|
||||
"compatible": "3.13.1",
|
||||
"compatible": "4.0.0",
|
||||
"notes": ""
|
||||
}
|
|
@ -2,9 +2,9 @@
|
|||
"author": "Bludit",
|
||||
"email": "",
|
||||
"website": "https://plugins.bludit.com",
|
||||
"version": "3.13.1",
|
||||
"releaseDate": "2020-07-28",
|
||||
"version": "4.0.0",
|
||||
"releaseDate": "2021-05-23",
|
||||
"license": "MIT",
|
||||
"compatible": "3.13.1",
|
||||
"compatible": "4.0.0",
|
||||
"notes": ""
|
||||
}
|
|
@ -2,9 +2,9 @@
|
|||
"author": "Bludit",
|
||||
"email": "",
|
||||
"website": "https://plugins.bludit.com",
|
||||
"version": "3.13.1",
|
||||
"releaseDate": "2020-07-28",
|
||||
"version": "4.0.0",
|
||||
"releaseDate": "2021-05-23",
|
||||
"license": "MIT",
|
||||
"compatible": "3.13.1",
|
||||
"compatible": "4.0.0",
|
||||
"notes": ""
|
||||
}
|
|
@ -2,9 +2,9 @@
|
|||
"author": "Bludit",
|
||||
"email": "",
|
||||
"website": "https://plugins.bludit.com",
|
||||
"version": "3.13.1",
|
||||
"releaseDate": "2020-07-28",
|
||||
"version": "4.0.0",
|
||||
"releaseDate": "2021-05-23",
|
||||
"license": "MIT",
|
||||
"compatible": "3.13.1",
|
||||
"compatible": "4.0.0",
|
||||
"notes": ""
|
||||
}
|
|
@ -2,9 +2,9 @@
|
|||
"author": "Bludit",
|
||||
"email": "",
|
||||
"website": "https://plugins.bludit.com",
|
||||
"version": "3.13.1",
|
||||
"releaseDate": "2020-07-28",
|
||||
"version": "4.0.0",
|
||||
"releaseDate": "2021-05-23",
|
||||
"license": "MIT",
|
||||
"compatible": "3.13.1",
|
||||
"compatible": "4.0.0",
|
||||
"notes": ""
|
||||
}
|
|
@ -2,9 +2,9 @@
|
|||
"author": "Bludit",
|
||||
"email": "",
|
||||
"website": "https://plugins.bludit.com",
|
||||
"version": "3.13.1",
|
||||
"releaseDate": "2020-07-28",
|
||||
"version": "4.0.0",
|
||||
"releaseDate": "2021-05-23",
|
||||
"license": "MIT",
|
||||
"compatible": "3.13.1",
|
||||
"compatible": "4.0.0",
|
||||
"notes": ""
|
||||
}
|
|
@ -2,9 +2,9 @@
|
|||
"author": "Bludit",
|
||||
"email": "",
|
||||
"website": "https://plugins.bludit.com",
|
||||
"version": "3.13.1",
|
||||
"releaseDate": "2020-07-28",
|
||||
"version": "4.0.0",
|
||||
"releaseDate": "2021-05-23",
|
||||
"license": "MIT",
|
||||
"compatible": "3.13.1",
|
||||
"compatible": "4.0.0",
|
||||
"notes": ""
|
||||
}
|
7
bl-plugins/popeye/languages/en.json
Normal file
7
bl-plugins/popeye/languages/en.json
Normal file
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
"plugin-data":
|
||||
{
|
||||
"name": "Popeye Theme",
|
||||
"description": "This plugin provides configuration for the theme Popeye."
|
||||
}
|
||||
}
|
11
bl-plugins/popeye/metadata.json
Normal file
11
bl-plugins/popeye/metadata.json
Normal file
|
@ -0,0 +1,11 @@
|
|||
{
|
||||
"author": "Bludit",
|
||||
"email": "",
|
||||
"website": "https://plugins.bludit.com",
|
||||
"version": "4.0.0",
|
||||
"releaseDate": "2021-05-23",
|
||||
"license": "MIT",
|
||||
"compatible": "4.0.0",
|
||||
"notes": "",
|
||||
"type": "theme"
|
||||
}
|
76
bl-plugins/popeye/plugin.php
Normal file
76
bl-plugins/popeye/plugin.php
Normal file
|
@ -0,0 +1,76 @@
|
|||
<?php
|
||||
class popeye extends Plugin {
|
||||
|
||||
public function init()
|
||||
{
|
||||
$this->dbFields = array(
|
||||
'googleFonts'=>false,
|
||||
'darkMode'=>false,
|
||||
'dateFormat'=>'relative',
|
||||
'showTags'=>true
|
||||
);
|
||||
}
|
||||
|
||||
public function form()
|
||||
{
|
||||
global $L;
|
||||
|
||||
$html = '<div class="mb-3">';
|
||||
$html .= '<label class="form-label" for="darkMode">'.$L->get('Dark Mode').'</label>';
|
||||
$html .= '<select class="form-select" id="darkMode" name="darkMode">';
|
||||
$html .= '<option value="true" '.($this->getValue('darkMode')===true?'selected':'').'>'.$L->get('Enabled').'</option>';
|
||||
$html .= '<option value="false" '.($this->getValue('darkMode')===false?'selected':'').'>'.$L->get('Disabled').'</option>';
|
||||
$html .= '</select>';
|
||||
$html .= '<div class="form-text">'.$L->get('Enable or disable dark mode.').'</div>';
|
||||
$html .= '</div>';
|
||||
|
||||
$html .= '<div class="mb-3">';
|
||||
$html .= '<label class="form-label" for="googleFonts">'.$L->get('Google Fonts').'</label>';
|
||||
$html .= '<select class="form-select" id="googleFonts" name="googleFonts">';
|
||||
$html .= '<option value="true" '.($this->getValue('googleFonts')===true?'selected':'').'>'.$L->get('Enabled').'</option>';
|
||||
$html .= '<option value="false" '.($this->getValue('googleFonts')===false?'selected':'').'>'.$L->get('Disabled').'</option>';
|
||||
$html .= '</select>';
|
||||
$html .= '<div class="form-text">'.$L->get('Enable or disable Google fonts.').'</div>';
|
||||
$html .= '</div>';
|
||||
|
||||
$html .= '<div class="mb-3">';
|
||||
$html .= '<label class="form-label" for="dateFormat">'.$L->get('Date format').'</label>';
|
||||
$html .= '<select class="form-select" id="dateFormat" name="dateFormat">';
|
||||
$html .= '<option value="relative" '.($this->getValue('dateFormat')=='relative'?'selected':'').'>'.$L->get('Relative').'</option>';
|
||||
$html .= '<option value="absolute" '.($this->getValue('dateFormat')=='absolute'?'selected':'').'>'.$L->get('Absolute').'</option>';
|
||||
$html .= '</select>';
|
||||
$html .= '<div class="form-text">'.$L->get('Change the date format for the main page.').'</div>';
|
||||
$html .= '</div>';
|
||||
|
||||
$html .= '<div class="mb-3">';
|
||||
$html .= '<label class="form-label" for="showTags">'.$L->get('Show tags').'</label>';
|
||||
$html .= '<select class="form-select" id="showTags" name="showTags">';
|
||||
$html .= '<option value="true" '.($this->getValue('showTags')===true?'selected':'').'>'.$L->get('Enabled').'</option>';
|
||||
$html .= '<option value="false" '.($this->getValue('showTags')===false?'selected':'').'>'.$L->get('Disabled').'</option>';
|
||||
$html .= '</select>';
|
||||
$html .= '<div class="form-text">'.$L->get('Show tags in the main page for each article.').'</div>';
|
||||
$html .= '</div>';
|
||||
|
||||
return $html;
|
||||
}
|
||||
|
||||
public function darkMode()
|
||||
{
|
||||
return $this->getValue('darkMode');
|
||||
}
|
||||
|
||||
public function googleFonts()
|
||||
{
|
||||
return $this->getValue('googleFonts');
|
||||
}
|
||||
|
||||
public function dateFormat()
|
||||
{
|
||||
return $this->getValue('dateFormat');
|
||||
}
|
||||
|
||||
public function showTags()
|
||||
{
|
||||
return $this->getValue('showTags');
|
||||
}
|
||||
}
|
|
@ -1,10 +0,0 @@
|
|||
{
|
||||
"complete-url-of-the-zip-file": "Den komplette URL sti, til der hvor zip filen befinder sig.",
|
||||
"plugin-data": {
|
||||
"description": "Denne udvidelse giver en nem måde at få indholdet fra dit websted uploadet til Github eller lignende service, og være fuld synkroniseret med din Bludit installation.",
|
||||
"name": "Remote Content"
|
||||
},
|
||||
"source": "Kilde",
|
||||
"try-webhook": "Prøv webhook'et",
|
||||
"webhook": "Webhook"
|
||||
}
|
|
@ -1,10 +0,0 @@
|
|||
{
|
||||
"plugin-data":
|
||||
{
|
||||
"name": "Remote Content",
|
||||
"description": "Das Plugin snychronisiert die Inhalte eines Repository wie GitHub mit einer Bludit-Installation."
|
||||
},
|
||||
"webhook": "Webhook",
|
||||
"source": "Quelle",
|
||||
"try-webhook": "Webhook testen",
|
||||
"complete-url-of-the-zip-file": "Vollständiger URL des ZIP-Archivs."}
|
|
@ -1,10 +0,0 @@
|
|||
{
|
||||
"plugin-data":
|
||||
{
|
||||
"name": "Remote Content",
|
||||
"description": "Das Plugin snychronisiert die Inhalte eines Repository wie GitHub mit einer Bludit-Installation."
|
||||
},
|
||||
"webhook": "Webhook",
|
||||
"source": "Quelle",
|
||||
"try-webhook": "Webhook testen",
|
||||
"complete-url-of-the-zip-file": "Vollständiger URL des ZIP-Archivs."}
|
|
@ -1,11 +0,0 @@
|
|||
{
|
||||
"plugin-data":
|
||||
{
|
||||
"name": "Remote Content",
|
||||
"description": "This plugin provides an easy way to have the content of your site on Github or similar and in turn is synchronized with your Bludit."
|
||||
},
|
||||
"webhook": "Webhook",
|
||||
"source": "Source",
|
||||
"try-webhook": "Try webhook",
|
||||
"complete-url-of-the-zip-file": "Complete URL of the zip file."
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
{
|
||||
"plugin-data":
|
||||
{
|
||||
"name": "Contenido remoto",
|
||||
"description": "Este plugin provee una forma facil de tener el contenido de tu sitio en Github o similar y a su vez esta sincronizado con tu Bludit."
|
||||
},
|
||||
"webhook": "Webhook",
|
||||
"source": "Origen",
|
||||
"try-webhook": "Probar webhook",
|
||||
"complete-url-of-the-zip-file": "URL completa del archivo zip."
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
{
|
||||
"plugin-data":
|
||||
{
|
||||
"name": "محتوای راه دور",
|
||||
"description": "این افزونه یک راه آسان برای داشتن محتوای سایت شما در Github یا مشابه دارد و به نوبه خود، با بلودیت شما هماهنگ شده است ."
|
||||
},
|
||||
"webhook": "Webhook",
|
||||
"source": "منبع",
|
||||
"try-webhook": "امتحان webhook",
|
||||
"complete-url-of-the-zip-file": "آدرس وب کامل فایل زیپ."
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
{
|
||||
"plugin-data":
|
||||
{
|
||||
"name": "Contenuto remoto",
|
||||
"description": "Questo plugin offre un modo semplice di avere il contenuto del proprio sito su Github e simili e di tenerli sincronizzati con Bludit."
|
||||
},
|
||||
"webhook": "Webhook",
|
||||
"source": "Sorgente",
|
||||
"try-webhook": "Prova webhook",
|
||||
"complete-url-of-the-zip-file": "URL completo del file zipe."
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
{
|
||||
"plugin-data":
|
||||
{
|
||||
"name": "Remote Content",
|
||||
"description": "This plugin provides an easy way to have the content of your site on Github or similar and in turn is synchronized with your Bludit."
|
||||
},
|
||||
"webhook": "Webhook",
|
||||
"source": "ソース",
|
||||
"try-webhook": "Try webhook",
|
||||
"complete-url-of-the-zip-file": "Complete URL of the zip file."
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
{
|
||||
"plugin-data":
|
||||
{
|
||||
"name": "Externe Inhoud",
|
||||
"description": "Met deze plugin is het eenvoudig om inhoud voor de website op GitHub of soortgelijke bronnen te beheren en vervolgens te synchroniseren met Bludit."
|
||||
},
|
||||
"webhook": "Web-hook",
|
||||
"source": "Bron",
|
||||
"try-webhook": "Web-hook testen",
|
||||
"complete-url-of-the-zip-file": "Complete URL van het .zip-bestand."
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
{
|
||||
"plugin-data":
|
||||
{
|
||||
"name": "Remote Content",
|
||||
"description": "Этот плагин обеспечивает простой способ синхронизации вашего сайта и Github или аналогичной платформы."
|
||||
},
|
||||
"webhook": "Вебхук",
|
||||
"source": "Источник",
|
||||
"try-webhook": "Попробовать этот вебхук",
|
||||
"complete-url-of-the-zip-file": "Полный URL-адрес zip-файла."
|
||||
}
|
|
@ -1,10 +0,0 @@
|
|||
{
|
||||
"author": "Bludit",
|
||||
"email": "",
|
||||
"website": "https://plugins.bludit.com/plugin/remote-content",
|
||||
"version": "3.13.1",
|
||||
"releaseDate": "2020-07-28",
|
||||
"license": "MIT",
|
||||
"compatible": "3.13.1",
|
||||
"notes": ""
|
||||
}
|
|
@ -1,209 +0,0 @@
|
|||
<?php
|
||||
|
||||
class pluginRemoteContent extends Plugin {
|
||||
|
||||
public function init()
|
||||
{
|
||||
// Generate a random string for the webhook
|
||||
$randomWebhook = uniqid();
|
||||
|
||||
// Key and value for the database of the plugin
|
||||
$this->dbFields = array(
|
||||
'webhook'=>$randomWebhook,
|
||||
'source'=>''
|
||||
);
|
||||
}
|
||||
|
||||
public function form()
|
||||
{
|
||||
global $language;
|
||||
|
||||
if (extension_loaded('zip')===false) {
|
||||
$this->formButtons = false;
|
||||
return '<div class="alert alert-success">'.$language->get('the-extension-zip-is-not-installed').'</div>';
|
||||
}
|
||||
|
||||
$html = '<div class="alert alert-primary" role="alert">';
|
||||
$html .= $this->description();
|
||||
$html .= '</div>';
|
||||
|
||||
$html .= '<div>';
|
||||
$html .= '<label>'.$language->get('Webhook').'</label>';
|
||||
$html .= '<input id="jswebhook" name="webhook" type="text" value="'.$this->getValue('webhook').'">';
|
||||
$html .= '<span class="tip">'.DOMAIN_BASE.$this->getValue('webhook').'</span>';
|
||||
$html .= '</div>';
|
||||
|
||||
$html .= '<div>';
|
||||
$html .= '<label>'.$language->get('Source').'</label>';
|
||||
$html .= '<input id="jssource" name="source" type="text" value="'.$this->getValue('source').'" placeholder="https://">';
|
||||
$html .= '<span class="tip">'.$language->get('Complete URL of the zip file').'</span>';
|
||||
$html .= '</div>';
|
||||
|
||||
$html .= '<hr>';
|
||||
$html .= '<div>';
|
||||
$html .= '<button type="button" id="jstryWebhook" class="btn btn-primary" onclick="tryWebhook()">'.$language->get('Try webhook').'</button>';
|
||||
$html .= <<<EOF
|
||||
<script>
|
||||
function tryWebhook() {
|
||||
var webhook = document.getElementById("jswebhook").value;
|
||||
window.open(DOMAIN_BASE+webhook, '_blank');
|
||||
}
|
||||
</script>
|
||||
EOF;
|
||||
$html .= '</div>';
|
||||
|
||||
return $html;
|
||||
}
|
||||
|
||||
public function beforeAll()
|
||||
{
|
||||
// Check Webhook
|
||||
$webhook = $this->getValue('webhook');
|
||||
if ($this->webhook($webhook)) {
|
||||
$this->cleanUp();
|
||||
|
||||
// Download files
|
||||
$this->downloadFiles();
|
||||
|
||||
// Delete the current content
|
||||
$this->deleteContent();
|
||||
|
||||
// Generate the new content
|
||||
$this->generateContent();
|
||||
|
||||
// End request
|
||||
$this->response(array('status'=>'0'));
|
||||
}
|
||||
}
|
||||
|
||||
private function downloadFiles()
|
||||
{
|
||||
// Download the zip file
|
||||
Log::set('Plugin Remote Content'.LOG_SEP.'Downloading the zip file.');
|
||||
$source = $this->getValue('source');
|
||||
$destinationPath = $this->workspace();
|
||||
$destinationFile = $destinationPath.'content.zip';
|
||||
TCP::download($source, $destinationFile);
|
||||
|
||||
// Uncompress the zip file
|
||||
Log::set('Plugin Remote Content'.LOG_SEP.'Uncompress the zip file.');
|
||||
$zip = new ZipArchive;
|
||||
if ($zip->open($destinationFile)===true) {
|
||||
$zip->extractTo($destinationPath);
|
||||
$zip->close();
|
||||
}
|
||||
|
||||
// Delete the zip file
|
||||
unlink($destinationFile);
|
||||
return true;
|
||||
}
|
||||
|
||||
// Delete the page and uploads directories from bl-content
|
||||
private function deleteContent()
|
||||
{
|
||||
// Clean the page database
|
||||
global $pages;
|
||||
$pages->db = array();
|
||||
|
||||
Filesystem::deleteRecursive(PATH_PAGES);
|
||||
Filesystem::deleteRecursive(PATH_UPLOADS);
|
||||
mkdir(PATH_PAGES, DIR_PERMISSIONS, true);
|
||||
mkdir(PATH_UPLOADS, DIR_PERMISSIONS, true);
|
||||
mkdir(PATH_UPLOADS_PROFILES, DIR_PERMISSIONS, true);
|
||||
mkdir(PATH_UPLOADS_THUMBNAILS, DIR_PERMISSIONS, true);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private function cleanUp()
|
||||
{
|
||||
$workspace = $this->workspace();
|
||||
Filesystem::deleteRecursive($workspace.DS);
|
||||
mkdir($workspace, DIR_PERMISSIONS, true);
|
||||
return true;
|
||||
}
|
||||
|
||||
private function generateContent()
|
||||
{
|
||||
global $pages;
|
||||
|
||||
$root = Filesystem::listDirectories($this->workspace());
|
||||
$root = $root[0]; // first directory created by the unzip
|
||||
|
||||
// For each page inside the pages directory
|
||||
// Parse the page and add to the database
|
||||
if (Filesystem::directoryExists($root.DS.'pages')) {
|
||||
$parentList = Filesystem::listDirectories($root.DS.'pages'.DS);
|
||||
foreach ($parentList as $parentDirectory) {
|
||||
$parentKey = basename($parentDirectory);
|
||||
if (Filesystem::fileExists($parentDirectory.DS.'index.md')) {
|
||||
$row = $this->parsePage($parentDirectory.DS.'index.md');
|
||||
$row['slug'] = $parentKey;
|
||||
$pages->add($row);
|
||||
}
|
||||
|
||||
$childList = Filesystem::listDirectories($parentDirectory.DS);
|
||||
foreach ($childList as $childDirectory) {
|
||||
$childKey = basename($childDirectory);
|
||||
if (Filesystem::fileExists($childDirectory.DS.'index.md')) {
|
||||
$row = $this->parsePage($childDirectory.DS.'index.md');
|
||||
$row['slug'] = $childKey;
|
||||
$row['parent'] = $parentKey;
|
||||
$pages->add($row);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
execPluginsByHook('afterPageCreate');
|
||||
reindexCategories();
|
||||
reindexTags();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private function response($data=array())
|
||||
{
|
||||
$json = json_encode($data);
|
||||
header('Content-Type: application/json');
|
||||
exit($json);
|
||||
}
|
||||
|
||||
private function parsePage($filename)
|
||||
{
|
||||
$lines = file($filename);
|
||||
$row = array();
|
||||
|
||||
// Title
|
||||
$title = ltrim($lines[0], '#'); // Remove the first #
|
||||
$title = trim($title);
|
||||
unset($lines[0]);
|
||||
$row['title'] = $title;
|
||||
|
||||
foreach ($lines as $key=>$line) {
|
||||
if (Text::startsWith($line, '<!--')) {
|
||||
$line = preg_replace('/<!\-\-/', '', $line);
|
||||
$line = preg_replace('/\-\->/', '', $line);
|
||||
$line = trim($line);
|
||||
|
||||
$explode = $explode = explode(':', $line, 2);
|
||||
|
||||
//$field = Text::lowercase($explode[0]);
|
||||
$field = $explode[0];
|
||||
$field = trim($field);
|
||||
unset($explode[0]);
|
||||
$row[$field] = trim($explode[1]);
|
||||
|
||||
unset($lines[$key]);
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$row['content'] = implode($lines);
|
||||
$row['username'] = 'admin';
|
||||
|
||||
return $row;
|
||||
}
|
||||
|
||||
}
|
|
@ -2,9 +2,9 @@
|
|||
"author": "Bludit",
|
||||
"email": "",
|
||||
"website": "https://plugins.bludit.com",
|
||||
"version": "3.13.1",
|
||||
"releaseDate": "2020-07-28",
|
||||
"version": "4.0.0",
|
||||
"releaseDate": "2021-05-23",
|
||||
"license": "MIT",
|
||||
"compatible": "3.13.1",
|
||||
"compatible": "4.0.0",
|
||||
"notes": ""
|
||||
}
|
|
@ -2,9 +2,9 @@
|
|||
"author": "Bludit",
|
||||
"email": "",
|
||||
"website": "https://plugins.bludit.com",
|
||||
"version": "3.13.1",
|
||||
"releaseDate": "2020-07-28",
|
||||
"version": "4.0.0",
|
||||
"releaseDate": "2021-05-23",
|
||||
"license": "MIT",
|
||||
"compatible": "3.13.1",
|
||||
"compatible": "4.0.0",
|
||||
"notes": ""
|
||||
}
|
|
@ -2,9 +2,9 @@
|
|||
"author": "Bludit",
|
||||
"email": "",
|
||||
"website": "https://plugins.bludit.com",
|
||||
"version": "3.13.1",
|
||||
"releaseDate": "2020-07-28",
|
||||
"version": "4.0.0",
|
||||
"releaseDate": "2021-05-23",
|
||||
"license": "MIT",
|
||||
"compatible": "3.13.1",
|
||||
"compatible": "4.0.0",
|
||||
"notes": ""
|
||||
}
|
|
@ -2,9 +2,9 @@
|
|||
"author": "Bludit",
|
||||
"email": "",
|
||||
"website": "https://plugins.bludit.com",
|
||||
"version": "3.13.1",
|
||||
"releaseDate": "2020-07-28",
|
||||
"version": "4.0.0",
|
||||
"releaseDate": "2021-05-23",
|
||||
"license": "MIT",
|
||||
"compatible": "3.13.1",
|
||||
"compatible": "4.0.0",
|
||||
"notes": ""
|
||||
}
|
|
@ -2,9 +2,9 @@
|
|||
"author": "Bludit",
|
||||
"email": "",
|
||||
"website": "https://plugins.bludit.com",
|
||||
"version": "3.13.1",
|
||||
"releaseDate": "2020-07-28",
|
||||
"version": "4.0.0",
|
||||
"releaseDate": "2021-05-23",
|
||||
"license": "MIT",
|
||||
"compatible": "3.13.1",
|
||||
"compatible": "4.0.0",
|
||||
"notes": ""
|
||||
}
|
|
@ -2,9 +2,9 @@
|
|||
"author": "Bludit",
|
||||
"email": "",
|
||||
"website": "https://plugins.bludit.com",
|
||||
"version": "3.13.1",
|
||||
"releaseDate": "2020-07-28",
|
||||
"version": "4.0.0",
|
||||
"releaseDate": "2021-05-23",
|
||||
"license": "MIT",
|
||||
"compatible": "3.13.1",
|
||||
"compatible": "4.0.0",
|
||||
"notes": ""
|
||||
}
|
|
@ -85,6 +85,11 @@ class pluginTinymce extends Plugin {
|
|||
$document_base_url = '';
|
||||
}
|
||||
|
||||
$skin = 'oxide';
|
||||
if ($site->darkModeAdmin()) {
|
||||
$skin = 'oxide-dark';
|
||||
}
|
||||
|
||||
return <<<EOF
|
||||
<script>
|
||||
|
||||
|
@ -110,7 +115,7 @@ class pluginTinymce extends Plugin {
|
|||
auto_focus: "editor",
|
||||
element_format : "html",
|
||||
entity_encoding : "raw",
|
||||
skin: "oxide-dark",
|
||||
skin: "$skin",
|
||||
schema: "html5",
|
||||
statusbar: false,
|
||||
menubar:false,
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
"author": "Bludit",
|
||||
"email": "",
|
||||
"website": "https://plugins.bludit.com",
|
||||
"version": "3.13.1",
|
||||
"releaseDate": "2020-07-28",
|
||||
"version": "4.0.0",
|
||||
"releaseDate": "2021-05-23",
|
||||
"license": "MIT",
|
||||
"compatible": "3.13.1",
|
||||
"compatible": "4.0.0",
|
||||
"notes": ""
|
||||
}
|
|
@ -2,9 +2,9 @@
|
|||
"author": "Bludit",
|
||||
"email": "",
|
||||
"website": "https://plugins.bludit.com",
|
||||
"version": "3.13.1",
|
||||
"releaseDate": "2020-07-28",
|
||||
"version": "4.0.0",
|
||||
"releaseDate": "2021-05-23",
|
||||
"license": "MIT",
|
||||
"compatible": "3.13.1",
|
||||
"compatible": "4.0.0",
|
||||
"notes": ""
|
||||
}
|
|
@ -51,7 +51,7 @@ class pluginVisitsStats extends Plugin {
|
|||
$labelUnique = $L->g('Unique');
|
||||
|
||||
return <<<EOF
|
||||
<div class="pluginVisitsStats mb-4">
|
||||
<div class="pluginVisitsStats mb-4 pt-4 border-top">
|
||||
<h3 class="m-0 p-0"><i class="bi bi-bar-chart"></i>$label</h3>
|
||||
<canvas id="visits-stats"></canvas>
|
||||
</div>
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
"author": "Bludit",
|
||||
"email": "",
|
||||
"website": "https://themes.bludit.com",
|
||||
"version": "3.13.1",
|
||||
"releaseDate": "2020-07-28",
|
||||
"version": "4.0.0",
|
||||
"releaseDate": "2021-05-23",
|
||||
"license": "MIT",
|
||||
"compatible": "3.13.1",
|
||||
"compatible": "4.0.0",
|
||||
"notes": ""
|
||||
}
|
|
@ -2,9 +2,9 @@
|
|||
"author": "Bludit",
|
||||
"email": "",
|
||||
"website": "https://themes.bludit.com",
|
||||
"version": "3.13.1",
|
||||
"releaseDate": "2020-07-28",
|
||||
"version": "4.0.0",
|
||||
"releaseDate": "2021-05-23",
|
||||
"license": "MIT",
|
||||
"compatible": "3.13.1",
|
||||
"compatible": "4.0.0",
|
||||
"notes": ""
|
||||
}
|
|
@ -28,14 +28,14 @@
|
|||
));
|
||||
|
||||
# Apply the following CSS only for Dark Mode
|
||||
if ($site->darkModeWebsite()) {
|
||||
if ($theme->darkMode()) {
|
||||
echo HTML::css(
|
||||
'css/99-darkmode.css'
|
||||
);
|
||||
}
|
||||
?>
|
||||
|
||||
<?php if ($googleFonts): ?>
|
||||
<?php if ($theme->googleFonts()): ?>
|
||||
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Open+Sans:sans,bold">
|
||||
<style>
|
||||
body { font-family: "Open Sans", sans-serif; }
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
<?php defined('BLUDIT') or die('Bludit CMS.');
|
||||
|
||||
$googleFonts = true;
|
||||
$darkMode = true;
|
||||
if ($theme==false) {
|
||||
exit("The theme needs the plugin Popeye to work properly, please enable it from the admin panel.");
|
||||
}
|
|
@ -3,8 +3,9 @@
|
|||
"email": "",
|
||||
"website": "https://themes.bludit.com",
|
||||
"version": "4.0",
|
||||
"releaseDate": "2020-07-28",
|
||||
"releaseDate": "2021-05-23",
|
||||
"license": "MIT",
|
||||
"compatible": "4.0",
|
||||
"notes": ""
|
||||
"notes": "",
|
||||
"plugin": "popeye"
|
||||
}
|
|
@ -68,7 +68,11 @@
|
|||
<!-- End Page title -->
|
||||
|
||||
<!-- Page date -->
|
||||
<small class="color-blue"><?php echo $tmp->relativeTime() ?></small>
|
||||
<?php if ($theme->dateFormat()=='relative'): ?>
|
||||
<small class="color-blue"><?php echo $tmp->relativeTime() ?></small>
|
||||
<?php else: ?>
|
||||
<small class="color-blue"><?php echo $tmp->date() ?></small>
|
||||
<?php endif ?>
|
||||
<!-- End Page date -->
|
||||
|
||||
</div>
|
||||
|
@ -81,13 +85,15 @@
|
|||
|
||||
<!-- Page tags -->
|
||||
<?php
|
||||
$tagsList = $tmp->tags(true);
|
||||
if (!empty($tagsList)) {
|
||||
echo '<small>';
|
||||
foreach ($tagsList as $tagKey => $tagName) {
|
||||
echo '<a class="badge bg-gray text-dark text-decoration-none me-2" href="' . DOMAIN_TAGS . $tagKey . '">' . $tagName . '</a>';
|
||||
if ($theme->showTags()) {
|
||||
$tagsList = $tmp->tags(true);
|
||||
if (!empty($tagsList)) {
|
||||
echo '<small>';
|
||||
foreach ($tagsList as $tagKey => $tagName) {
|
||||
echo '<a class="badge bg-gray text-dark text-decoration-none me-2" href="' . DOMAIN_TAGS . $tagKey . '">' . $tagName . '</a>';
|
||||
}
|
||||
echo '</small>';
|
||||
}
|
||||
echo '</small>';
|
||||
}
|
||||
?>
|
||||
<!-- End Page tags -->
|
||||
|
|
725
install.php
725
install.php
|
@ -7,11 +7,16 @@
|
|||
* Bludit is opensource software licensed under the MIT license.
|
||||
*/
|
||||
|
||||
// ============================================================================
|
||||
// Requirements basic checks
|
||||
// ============================================================================
|
||||
|
||||
// Check PHP version
|
||||
if (version_compare(phpversion(), '5.6', '<')) {
|
||||
$errorText = 'Current PHP version '.phpversion().', you need > 5.6.';
|
||||
error_log('[ERROR] '.$errorText, 0);
|
||||
exit($errorText);
|
||||
echo 'Current PHP version ' . phpversion() . ', you need > 5.6.';
|
||||
echo '';
|
||||
echo '<a href="https://docs.bludit.com/en/getting-started/requirements">Please read Bludit requirements</a>.';
|
||||
exit(1);
|
||||
}
|
||||
|
||||
// Check PHP modules
|
||||
|
@ -20,11 +25,11 @@ $modulesRequiredExit = false;
|
|||
$modulesRequiredMissing = '';
|
||||
foreach ($modulesRequired as $module) {
|
||||
if (!extension_loaded($module)) {
|
||||
$errorText = 'PHP module <b>'.$module.'</b> is not installed.';
|
||||
error_log('[ERROR] '.$errorText, 0);
|
||||
$errorText = 'PHP module <b>' . $module . '</b> is not installed.';
|
||||
error_log('[ERROR] ' . $errorText, 0);
|
||||
|
||||
$modulesRequiredExit = true;
|
||||
$modulesRequiredMissing .= $errorText.PHP_EOL;
|
||||
$modulesRequiredMissing .= $errorText . PHP_EOL;
|
||||
}
|
||||
}
|
||||
if ($modulesRequiredExit) {
|
||||
|
@ -32,9 +37,13 @@ if ($modulesRequiredExit) {
|
|||
echo $modulesRequiredMissing;
|
||||
echo '';
|
||||
echo '<a href="https://docs.bludit.com/en/getting-started/requirements">Please read Bludit requirements</a>.';
|
||||
exit(0);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
// Bludit constanst, variables, language and locale settings
|
||||
// ============================================================================
|
||||
|
||||
// Security constant
|
||||
define('BLUDIT', true);
|
||||
|
||||
|
@ -42,31 +51,37 @@ define('BLUDIT', true);
|
|||
define('DS', DIRECTORY_SEPARATOR);
|
||||
|
||||
// PHP paths
|
||||
define('PATH_ROOT', __DIR__.DS);
|
||||
define('PATH_CONTENT', PATH_ROOT.'bl-content'.DS);
|
||||
define('PATH_KERNEL', PATH_ROOT.'bl-kernel'.DS);
|
||||
define('PATH_LANGUAGES', PATH_ROOT.'bl-languages'.DS);
|
||||
define('PATH_UPLOADS', PATH_CONTENT.'uploads'.DS);
|
||||
define('PATH_TMP', PATH_CONTENT.'tmp'.DS);
|
||||
define('PATH_PAGES', PATH_CONTENT.'pages'.DS);
|
||||
define('PATH_WORKSPACES', PATH_CONTENT.'workspaces'.DS);
|
||||
define('PATH_DATABASES', PATH_CONTENT.'databases'.DS);
|
||||
define('PATH_PLUGINS_DATABASES',PATH_CONTENT.'databases'.DS.'plugins'.DS);
|
||||
define('PATH_UPLOADS_PROFILES', PATH_UPLOADS.'profiles'.DS);
|
||||
define('PATH_UPLOADS_THUMBNAILS',PATH_UPLOADS.'thumbnails'.DS);
|
||||
define('PATH_UPLOADS_PAGES', PATH_UPLOADS.'pages'.DS);
|
||||
define('PATH_HELPERS', PATH_KERNEL.'helpers'.DS);
|
||||
define('PATH_ABSTRACT', PATH_KERNEL.'abstract'.DS);
|
||||
define('PATH_ROOT', __DIR__ . DS);
|
||||
define('PATH_CONTENT', PATH_ROOT . 'bl-content' . DS);
|
||||
define('PATH_KERNEL', PATH_ROOT . 'bl-kernel' . DS);
|
||||
define('PATH_LANGUAGES', PATH_ROOT . 'bl-languages' . DS);
|
||||
define('PATH_UPLOADS', PATH_CONTENT . 'uploads' . DS);
|
||||
define('PATH_TMP', PATH_CONTENT . 'tmp' . DS);
|
||||
define('PATH_PAGES', PATH_CONTENT . 'pages' . DS);
|
||||
define('PATH_WORKSPACES', PATH_CONTENT . 'workspaces' . DS);
|
||||
define('PATH_DATABASES', PATH_CONTENT . 'databases' . DS);
|
||||
define('PATH_PLUGINS_DATABASES', PATH_CONTENT . 'databases' . DS . 'plugins' . DS);
|
||||
define('PATH_UPLOADS_PROFILES', PATH_UPLOADS . 'profiles' . DS);
|
||||
define('PATH_UPLOADS_THUMBNAILS', PATH_UPLOADS . 'thumbnails' . DS);
|
||||
define('PATH_UPLOADS_PAGES', PATH_UPLOADS . 'pages' . DS);
|
||||
define('PATH_HELPERS', PATH_KERNEL . 'helpers' . DS);
|
||||
define('PATH_ABSTRACT', PATH_KERNEL . 'abstract' . DS);
|
||||
|
||||
// Protecting against Symlink attacks
|
||||
define('CHECK_SYMBOLIC_LINKS', TRUE);
|
||||
define('CHECK_SYMBOLIC_LINKS', TRUE);
|
||||
define('FILENAME', 'index.txt');
|
||||
define('LOG_SEP', ' | ');
|
||||
define('DB_DATE_FORMAT', 'Y-m-d H:i:s');
|
||||
define('CHARSET', 'UTF-8');
|
||||
define('DEFAULT_LANGUAGE_FILE', 'en.json');
|
||||
define('DIR_PERMISSIONS', 0755);
|
||||
|
||||
// Filename for pages
|
||||
define('FILENAME', 'index.txt');
|
||||
if (!defined('JSON_PRETTY_PRINT')) {
|
||||
define('JSON_PRETTY_PRINT', 128);
|
||||
}
|
||||
|
||||
// Domain and protocol
|
||||
define('DOMAIN', $_SERVER['HTTP_HOST']);
|
||||
|
||||
if (!empty($_SERVER['HTTPS'])) {
|
||||
define('PROTOCOL', 'https://');
|
||||
} else {
|
||||
|
@ -76,20 +91,19 @@ if (!empty($_SERVER['HTTPS'])) {
|
|||
// Base URL
|
||||
// Change the base URL or leave it empty if you want to Bludit try to detect the base URL.
|
||||
$base = '';
|
||||
|
||||
if (!empty($_SERVER['DOCUMENT_ROOT']) && !empty($_SERVER['SCRIPT_NAME']) && empty($base)) {
|
||||
$base = str_replace($_SERVER['DOCUMENT_ROOT'], '', $_SERVER['SCRIPT_NAME']);
|
||||
$base = dirname($base);
|
||||
} elseif (empty($base)) {
|
||||
$base = empty( $_SERVER['SCRIPT_NAME'] ) ? $_SERVER['PHP_SELF'] : $_SERVER['SCRIPT_NAME'];
|
||||
$base = empty($_SERVER['SCRIPT_NAME']) ? $_SERVER['PHP_SELF'] : $_SERVER['SCRIPT_NAME'];
|
||||
$base = dirname($base);
|
||||
}
|
||||
|
||||
if (strpos($_SERVER['REQUEST_URI'], $base)!==0) {
|
||||
if (strpos($_SERVER['REQUEST_URI'], $base) !== 0) {
|
||||
$base = '/';
|
||||
} elseif ($base!=DS) {
|
||||
} elseif ($base != DS) {
|
||||
$base = trim($base, '/');
|
||||
$base = '/'.$base.'/';
|
||||
$base = '/' . $base . '/';
|
||||
} else {
|
||||
// Workaround for Windows Web Servers
|
||||
$base = '/';
|
||||
|
@ -97,40 +111,20 @@ if (strpos($_SERVER['REQUEST_URI'], $base)!==0) {
|
|||
|
||||
define('HTML_PATH_ROOT', $base);
|
||||
|
||||
// Log separator
|
||||
define('LOG_SEP', ' | ');
|
||||
|
||||
// JSON
|
||||
if (!defined('JSON_PRETTY_PRINT')) {
|
||||
define('JSON_PRETTY_PRINT', 128);
|
||||
}
|
||||
|
||||
// Database format date
|
||||
define('DB_DATE_FORMAT', 'Y-m-d H:i:s');
|
||||
|
||||
// Charset, default UTF-8.
|
||||
define('CHARSET', 'UTF-8');
|
||||
|
||||
// Default language file
|
||||
define('DEFAULT_LANGUAGE_FILE', 'en.json');
|
||||
|
||||
// Set internal character encoding
|
||||
mb_internal_encoding(CHARSET);
|
||||
|
||||
// Set HTTP output character encoding
|
||||
mb_http_output(CHARSET);
|
||||
|
||||
// Directory permissions
|
||||
define('DIR_PERMISSIONS', 0755);
|
||||
|
||||
// --- PHP Classes ---
|
||||
include(PATH_ABSTRACT.'dbjson.class.php');
|
||||
include(PATH_HELPERS.'sanitize.class.php');
|
||||
include(PATH_HELPERS.'valid.class.php');
|
||||
include(PATH_HELPERS.'text.class.php');
|
||||
include(PATH_HELPERS.'log.class.php');
|
||||
include(PATH_HELPERS.'date.class.php');
|
||||
include(PATH_KERNEL.'language.class.php');
|
||||
include(PATH_ABSTRACT . 'dbjson.class.php');
|
||||
include(PATH_HELPERS . 'sanitize.class.php');
|
||||
include(PATH_HELPERS . 'valid.class.php');
|
||||
include(PATH_HELPERS . 'text.class.php');
|
||||
include(PATH_HELPERS . 'log.class.php');
|
||||
include(PATH_HELPERS . 'date.class.php');
|
||||
include(PATH_KERNEL . 'language.class.php');
|
||||
|
||||
// --- LANGUAGE and LOCALE ---
|
||||
// Try to detect the language from browser or headers
|
||||
|
@ -151,8 +145,8 @@ if (isset($_GET['language'])) {
|
|||
|
||||
$finalLanguage = 'en';
|
||||
$languageFiles = getLanguageList();
|
||||
foreach ($languageFiles as $fname=>$native) {
|
||||
if ( ($languageFromHTTP==$fname) || ($localeFromHTTP==$fname) ) {
|
||||
foreach ($languageFiles as $fname => $native) {
|
||||
if (($languageFromHTTP == $fname) || ($localeFromHTTP == $fname)) {
|
||||
$finalLanguage = $fname;
|
||||
}
|
||||
}
|
||||
|
@ -163,7 +157,6 @@ $L = $language = new Language($finalLanguage);
|
|||
setlocale(LC_ALL, $localeFromHTTP);
|
||||
|
||||
// --- TIMEZONE ---
|
||||
|
||||
// Check if timezone is defined in php.ini
|
||||
$iniDate = ini_get('date.timezone');
|
||||
if (empty($iniDate)) {
|
||||
|
@ -176,8 +169,9 @@ if (empty($iniDate)) {
|
|||
// ============================================================================
|
||||
|
||||
// Returns an array with all languages
|
||||
function getLanguageList() {
|
||||
$files = glob(PATH_LANGUAGES.'*.json');
|
||||
function getLanguageList()
|
||||
{
|
||||
$files = glob(PATH_LANGUAGES . '*.json');
|
||||
$tmp = array();
|
||||
foreach ($files as $file) {
|
||||
$t = new dbJSON($file, false);
|
||||
|
@ -190,8 +184,9 @@ function getLanguageList() {
|
|||
}
|
||||
|
||||
// Check if Bludit is installed
|
||||
function alreadyInstalled() {
|
||||
return file_exists(PATH_DATABASES.'site.php');
|
||||
function alreadyInstalled()
|
||||
{
|
||||
return file_exists(PATH_DATABASES . 'site.php');
|
||||
}
|
||||
|
||||
// Check write permissions and .htaccess file
|
||||
|
@ -208,7 +203,7 @@ function checkSystem()
|
|||
RewriteEngine on
|
||||
|
||||
# Base directory
|
||||
RewriteBase '.HTML_PATH_ROOT.'
|
||||
RewriteBase ' . HTML_PATH_ROOT . '
|
||||
|
||||
# Deny direct access to the next directories
|
||||
RewriteRule ^bl-content/(databases|workspaces|pages|tmp)/.*$ - [R=404,L]
|
||||
|
@ -220,22 +215,22 @@ RewriteRule ^(.*) index.php [PT,L]
|
|||
|
||||
</IfModule>';
|
||||
|
||||
if (!file_put_contents(PATH_ROOT.'.htaccess', $htaccessContent)) {
|
||||
if (!file_put_contents(PATH_ROOT . '.htaccess', $htaccessContent)) {
|
||||
if (!empty($_SERVER['SERVER_SOFTWARE'])) {
|
||||
$webserver = Text::lowercase($_SERVER['SERVER_SOFTWARE']);
|
||||
if (Text::stringContains($webserver, 'apache') || Text::stringContains($webserver, 'litespeed')) {
|
||||
$errorText = 'Missing file, upload the file .htaccess';
|
||||
error_log('[ERROR] '.$errorText, 0);
|
||||
$errorText = 'Missing file, upload the file .htaccess to the root directory.';
|
||||
error_log('[ERROR] ' . $errorText, 0);
|
||||
array_push($output, $errorText);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Check mod_rewrite module
|
||||
if (function_exists('apache_get_modules') ) {
|
||||
if (function_exists('apache_get_modules')) {
|
||||
if (!in_array('mod_rewrite', apache_get_modules())) {
|
||||
$errorText = 'Module mod_rewrite is not installed or loaded.';
|
||||
error_log('[ERROR] '.$errorText, 0);
|
||||
error_log('[ERROR] ' . $errorText, 0);
|
||||
array_push($output, $errorText);
|
||||
}
|
||||
}
|
||||
|
@ -246,7 +241,7 @@ RewriteRule ^(.*) index.php [PT,L]
|
|||
// Check if the directory content is writeable.
|
||||
if (!is_writable(PATH_CONTENT)) {
|
||||
$errorText = 'Writing test failure, check directory "bl-content" permissions.';
|
||||
error_log('[ERROR] '.$errorText, 0);
|
||||
error_log('[ERROR] ' . $errorText, 0);
|
||||
array_push($output, $errorText);
|
||||
}
|
||||
|
||||
|
@ -271,278 +266,327 @@ function install($adminPassword, $timezone)
|
|||
// Directories for initial pages
|
||||
$pagesToInstall = array('example-page-1-slug', 'example-page-2-slug', 'example-page-3-slug', 'example-page-4-slug');
|
||||
foreach ($pagesToInstall as $page) {
|
||||
if (!mkdir(PATH_PAGES.$L->get($page), DIR_PERMISSIONS, true)) {
|
||||
$errorText = 'Error when trying to created the directory=>'.PATH_PAGES.$L->get($page);
|
||||
error_log('[ERROR] '.$errorText, 0);
|
||||
if (!mkdir(PATH_PAGES . $L->get($page), DIR_PERMISSIONS, true)) {
|
||||
$errorText = 'Error when trying to created the directory=>' . PATH_PAGES . $L->get($page);
|
||||
error_log('[ERROR] ' . $errorText, 0);
|
||||
}
|
||||
}
|
||||
|
||||
// Directories for initial plugins
|
||||
$pluginsToInstall = array('tinymce', 'about', 'simple-stats', 'robots', 'canonical');
|
||||
$pluginsToInstall = array('tinymce', 'about', 'welcome', 'api', 'visits-stats', 'robots', 'canonical', 'popeye');
|
||||
foreach ($pluginsToInstall as $plugin) {
|
||||
if (!mkdir(PATH_PLUGINS_DATABASES.$plugin, DIR_PERMISSIONS, true)) {
|
||||
$errorText = 'Error when trying to created the directory=>'.PATH_PLUGINS_DATABASES.$plugin;
|
||||
error_log('[ERROR] '.$errorText, 0);
|
||||
if (!mkdir(PATH_PLUGINS_DATABASES . $plugin, DIR_PERMISSIONS, true)) {
|
||||
$errorText = 'Error when trying to created the directory=>' . PATH_PLUGINS_DATABASES . $plugin;
|
||||
error_log('[ERROR] ' . $errorText, 0);
|
||||
}
|
||||
}
|
||||
|
||||
// Directories for upload files
|
||||
if (!mkdir(PATH_UPLOADS_PROFILES, DIR_PERMISSIONS, true)) {
|
||||
$errorText = 'Error when trying to created the directory=>'.PATH_UPLOADS_PROFILES;
|
||||
error_log('[ERROR] '.$errorText, 0);
|
||||
}
|
||||
|
||||
if (!mkdir(PATH_UPLOADS_THUMBNAILS, DIR_PERMISSIONS, true)) {
|
||||
$errorText = 'Error when trying to created the directory=>'.PATH_UPLOADS_THUMBNAILS;
|
||||
error_log('[ERROR] '.$errorText, 0);
|
||||
}
|
||||
|
||||
if (!mkdir(PATH_TMP, DIR_PERMISSIONS, true)) {
|
||||
$errorText = 'Error when trying to created the directory=>'.PATH_TMP;
|
||||
error_log('[ERROR] '.$errorText, 0);
|
||||
}
|
||||
|
||||
if (!mkdir(PATH_WORKSPACES, DIR_PERMISSIONS, true)) {
|
||||
$errorText = 'Error when trying to created the directory=>'.PATH_WORKSPACES;
|
||||
error_log('[ERROR] '.$errorText, 0);
|
||||
}
|
||||
|
||||
if (!mkdir(PATH_UPLOADS_PAGES, DIR_PERMISSIONS, true)) {
|
||||
$errorText = 'Error when trying to created the directory=>'.PATH_UPLOADS_PAGES;
|
||||
error_log('[ERROR] '.$errorText, 0);
|
||||
// System directories
|
||||
$systemDirectories = array(PATH_UPLOADS_PROFILES, PATH_UPLOADS_THUMBNAILS, PATH_TMP, PATH_WORKSPACES, PATH_UPLOADS_PAGES);
|
||||
foreach ($systemDirectories as $directory) {
|
||||
if (!mkdir($directory, DIR_PERMISSIONS, true)) {
|
||||
$errorText = 'Error when trying to created the directory=>' . $directory;
|
||||
error_log('[ERROR] ' . $errorText, 0);
|
||||
}
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
// Create files
|
||||
// ============================================================================
|
||||
|
||||
$dataHead = "<?php defined('BLUDIT') or die('Bludit CMS.'); ?>".PHP_EOL;
|
||||
$dataHead = "<?php defined('BLUDIT') or die('Bludit CMS.'); ?>" . PHP_EOL;
|
||||
|
||||
$data = array();
|
||||
$slugs = array();
|
||||
$nextDate = $currentDate;
|
||||
foreach ($pagesToInstall as $page) {
|
||||
|
||||
$slug = $page;
|
||||
$title = Text::replace('slug','title', $slug);
|
||||
$content = Text::replace('slug','content', $slug);
|
||||
$title = Text::replace('slug', 'title', $slug);
|
||||
$content = Text::replace('slug', 'content', $slug);
|
||||
$nextDate = Date::offset($nextDate, DB_DATE_FORMAT, '-1 minute');
|
||||
|
||||
$data[$L->get($slug)]= array(
|
||||
'title'=>$L->get($title),
|
||||
'description'=>'',
|
||||
'username'=>'admin',
|
||||
'tags'=>array(),
|
||||
'type'=>(($slug=='example-page-4-slug')?'static':'published'),
|
||||
'date'=>$nextDate,
|
||||
'dateModified'=>'',
|
||||
'allowComments'=>true,
|
||||
'position'=>1,
|
||||
'coverImage'=>'',
|
||||
'md5file'=>'',
|
||||
'category'=>'general',
|
||||
'uuid'=>md5(uniqid()),
|
||||
'parent'=>'',
|
||||
'template'=>'',
|
||||
'noindex'=>false,
|
||||
'nofollow'=>false,
|
||||
'noarchive'=>false
|
||||
$data[$L->get($slug)] = array(
|
||||
'title' => $L->get($title),
|
||||
'description' => '',
|
||||
'username' => 'admin',
|
||||
'tags' => array(),
|
||||
'type' => (($slug == 'example-page-4-slug') ? 'static' : 'published'),
|
||||
'date' => $nextDate,
|
||||
'dateModified' => '',
|
||||
'allowComments' => true,
|
||||
'position' => 1,
|
||||
'coverImage' => '',
|
||||
'md5file' => '',
|
||||
'category' => 'general',
|
||||
'uuid' => md5(uniqid()),
|
||||
'parent' => '',
|
||||
'template' => '',
|
||||
'noindex' => false,
|
||||
'nofollow' => false,
|
||||
'noarchive' => false
|
||||
);
|
||||
|
||||
array_push($slugs, $slug);
|
||||
|
||||
file_put_contents(PATH_PAGES.$L->get($slug).DS.FILENAME, $L->get($content), LOCK_EX);
|
||||
file_put_contents(PATH_PAGES . $L->get($slug) . DS . FILENAME, $L->get($content), LOCK_EX);
|
||||
}
|
||||
file_put_contents(PATH_DATABASES.'pages.php', $dataHead.json_encode($data, JSON_PRETTY_PRINT), LOCK_EX);
|
||||
file_put_contents(PATH_DATABASES . 'pages.php', $dataHead . json_encode($data, JSON_PRETTY_PRINT), LOCK_EX);
|
||||
|
||||
// File site.php
|
||||
|
||||
// If Bludit is not installed inside a folder, the URL doesn't need finish with /
|
||||
// Example (root): https://domain.com
|
||||
// Example (inside a folder): https://domain.com/folder/
|
||||
if (HTML_PATH_ROOT=='/') {
|
||||
$siteUrl = PROTOCOL.DOMAIN;
|
||||
if (HTML_PATH_ROOT == '/') {
|
||||
$siteUrl = PROTOCOL . DOMAIN;
|
||||
} else {
|
||||
$siteUrl = PROTOCOL.DOMAIN.HTML_PATH_ROOT;
|
||||
$siteUrl = PROTOCOL . DOMAIN . HTML_PATH_ROOT;
|
||||
}
|
||||
$data = array(
|
||||
'title'=>'BLUDIT',
|
||||
'slogan'=>$L->get('welcome-to-bludit'),
|
||||
'description'=>$L->get('congratulations-you-have-successfully-installed-your-bludit'),
|
||||
'footer'=>'Copyright © '.Date::current('Y'),
|
||||
'itemsPerPage'=>6,
|
||||
'language'=>$L->currentLanguage(),
|
||||
'locale'=>$L->locale(),
|
||||
'timezone'=>$timezone,
|
||||
'theme'=>'alternative',
|
||||
'adminTheme'=>'booty',
|
||||
'homepage'=>'',
|
||||
'pageNotFound'=>'',
|
||||
'uriPage'=>'/',
|
||||
'uriTag'=>'/tag/',
|
||||
'uriCategory'=>'/category/',
|
||||
'uriBlog'=>'',
|
||||
'url'=>$siteUrl,
|
||||
'emailFrom'=>'no-reply@'.DOMAIN,
|
||||
'orderBy'=>'date',
|
||||
'currentBuild'=>'0',
|
||||
'twitter'=>'https://twitter.com/bludit',
|
||||
'facebook'=>'https://www.facebook.com/bluditcms',
|
||||
'codepen'=>'',
|
||||
'github'=> 'https://github.com/bludit',
|
||||
'instagram'=>'',
|
||||
'gitlab'=>'',
|
||||
'linkedin'=>'',
|
||||
'xing'=>'',
|
||||
'dateFormat'=>'F j, Y',
|
||||
'extremeFriendly'=>true,
|
||||
'autosaveInterval'=>2,
|
||||
'titleFormatHomepage'=>'{{site-slogan}} | {{site-title}}',
|
||||
'titleFormatPages'=>'{{page-title}} | {{site-title}}',
|
||||
'titleFormatCategory'=>'{{category-name}} | {{site-title}}',
|
||||
'titleFormatTag'=>'{{tag-name}} | {{site-title}}',
|
||||
'imageRestrict'=>true,
|
||||
'imageRelativeToAbsolute'=>false
|
||||
'title' => 'BLUDIT',
|
||||
'slogan' => $L->get('welcome-to-bludit'),
|
||||
'description' => $L->get('congratulations-you-have-successfully-installed-your-bludit'),
|
||||
'footer' => 'Copyright © ' . Date::current('Y'),
|
||||
'itemsPerPage' => 6,
|
||||
'language' => $L->currentLanguage(),
|
||||
'locale' => $L->locale(),
|
||||
'timezone' => $timezone,
|
||||
'theme' => 'popeye',
|
||||
'adminTheme' => 'booty',
|
||||
'homepage' => '',
|
||||
'pageNotFound' => '',
|
||||
'uriPage' => '/',
|
||||
'uriTag' => '/tag/',
|
||||
'uriCategory' => '/category/',
|
||||
'uriBlog' => '',
|
||||
'url' => $siteUrl,
|
||||
'emailFrom' => 'no-reply@' . DOMAIN,
|
||||
'orderBy' => 'date',
|
||||
'currentBuild' => '0',
|
||||
'twitter' => 'https://twitter.com/bludit',
|
||||
'facebook' => 'https://www.facebook.com/bluditcms',
|
||||
'codepen' => '',
|
||||
'github' => 'https://github.com/bludit',
|
||||
'instagram' => '',
|
||||
'gitlab' => '',
|
||||
'linkedin' => '',
|
||||
'xing' => '',
|
||||
'mastodon' => '',
|
||||
'dribbble' => '',
|
||||
'vk' => '',
|
||||
'discord' => '',
|
||||
'youtube' => '',
|
||||
'dateFormat' => 'F j, Y',
|
||||
'timeFormat' => 'g:i a',
|
||||
'extremeFriendly' => true,
|
||||
'autosaveInterval' => 2,
|
||||
'titleFormatHomepage' => '{{site-slogan}} | {{site-title}}',
|
||||
'titleFormatPages' => '{{page-title}} | {{site-title}}',
|
||||
'titleFormatCategory' => '{{category-name}} | {{site-title}}',
|
||||
'titleFormatTag' => '{{tag-name}} | {{site-title}}',
|
||||
'imageRestrict' => true,
|
||||
'imageRelativeToAbsolute' => false,
|
||||
'thumbnailWidth' => 400,
|
||||
'thumbnailHeight' => 400,
|
||||
'thumbnailQuality' => 100,
|
||||
'logo' => '',
|
||||
'markdownParser' => true,
|
||||
'customFields' => '{}',
|
||||
'darkModeAdmin' => false
|
||||
);
|
||||
file_put_contents(PATH_DATABASES.'site.php', $dataHead.json_encode($data, JSON_PRETTY_PRINT), LOCK_EX);
|
||||
file_put_contents(PATH_DATABASES . 'site.php', $dataHead . json_encode($data, JSON_PRETTY_PRINT), LOCK_EX);
|
||||
|
||||
// File users.php
|
||||
$salt = uniqid();
|
||||
$passwordHash = sha1($adminPassword.$salt);
|
||||
$tokenAuth = md5( uniqid().time().DOMAIN );
|
||||
$passwordHash = sha1($adminPassword . $salt);
|
||||
$tokenAuth = md5(uniqid() . time() . DOMAIN);
|
||||
|
||||
$data = array(
|
||||
'admin'=>array(
|
||||
'nickname'=>'Admin',
|
||||
'firstName'=>$L->get('Administrator'),
|
||||
'lastName'=>'',
|
||||
'role'=>'admin',
|
||||
'password'=>$passwordHash,
|
||||
'salt'=>$salt,
|
||||
'email'=>'',
|
||||
'registered'=>$currentDate,
|
||||
'tokenRemember'=>'',
|
||||
'tokenAuth'=>$tokenAuth,
|
||||
'tokenAuthTTL'=>'2009-03-15 14:00',
|
||||
'twitter'=>'',
|
||||
'facebook'=>'',
|
||||
'instagram'=>'',
|
||||
'codepen'=>'',
|
||||
'linkedin'=>'',
|
||||
'xing'=>'',
|
||||
'github'=>'',
|
||||
'gitlab'=>''
|
||||
'admin' => array(
|
||||
'nickname' => 'Admin',
|
||||
'firstName' => $L->get('Administrator'),
|
||||
'lastName' => '',
|
||||
'bio' => '',
|
||||
'role' => 'admin',
|
||||
'password' => $passwordHash,
|
||||
'salt' => $salt,
|
||||
'email' => '',
|
||||
'registered' => $currentDate,
|
||||
'tokenRemember' => '',
|
||||
'tokenAuth' => $tokenAuth,
|
||||
'tokenAuthTTL' => '2009-03-15 14:00',
|
||||
'twitter' => '',
|
||||
'facebook' => '',
|
||||
'instagram' => '',
|
||||
'codepen' => '',
|
||||
'linkedin' => '',
|
||||
'xing' => '',
|
||||
'github' => '',
|
||||
'gitlab' => '',
|
||||
'mastodon' => '',
|
||||
'vk' => '',
|
||||
'youtube' => '',
|
||||
'discord' => ''
|
||||
)
|
||||
);
|
||||
file_put_contents(PATH_DATABASES.'users.php', $dataHead.json_encode($data, JSON_PRETTY_PRINT), LOCK_EX);
|
||||
file_put_contents(PATH_DATABASES . 'users.php', $dataHead . json_encode($data, JSON_PRETTY_PRINT), LOCK_EX);
|
||||
|
||||
// File syslog.php
|
||||
$data = array(
|
||||
array(
|
||||
'date'=>$currentDate,
|
||||
'dictionaryKey'=>'welcome-to-bludit',
|
||||
'notes'=>'',
|
||||
'idExecution'=>uniqid(),
|
||||
'method'=>'POST',
|
||||
'username'=>'admin'
|
||||
));
|
||||
file_put_contents(PATH_DATABASES.'syslog.php', $dataHead.json_encode($data, JSON_PRETTY_PRINT), LOCK_EX);
|
||||
'date' => $currentDate,
|
||||
'dictionaryKey' => 'welcome-to-bludit',
|
||||
'notes' => '',
|
||||
'idExecution' => uniqid(),
|
||||
'method' => 'POST',
|
||||
'username' => 'admin'
|
||||
)
|
||||
);
|
||||
file_put_contents(PATH_DATABASES . 'syslog.php', $dataHead . json_encode($data, JSON_PRETTY_PRINT), LOCK_EX);
|
||||
|
||||
// File security.php
|
||||
$data = array(
|
||||
'minutesBlocked'=>5,
|
||||
'numberFailuresAllowed'=>10,
|
||||
'blackList'=>array()
|
||||
'minutesBlocked' => 5,
|
||||
'numberFailuresAllowed' => 10,
|
||||
'blackList' => array()
|
||||
);
|
||||
file_put_contents(PATH_DATABASES.'security.php', $dataHead.json_encode($data, JSON_PRETTY_PRINT), LOCK_EX);
|
||||
file_put_contents(PATH_DATABASES . 'security.php', $dataHead . json_encode($data, JSON_PRETTY_PRINT), LOCK_EX);
|
||||
|
||||
// File categories.php
|
||||
$data = array(
|
||||
'general'=>array('name'=>'General', 'description'=>'', 'template'=>'', 'list'=>$slugs),
|
||||
'music'=>array('name'=>'Music', 'description'=>'', 'template'=>'', 'list'=>array()),
|
||||
'videos'=>array('name'=>'Videos', 'description'=>'', 'template'=>'', 'list'=>array())
|
||||
'general' => array('name' => 'General', 'description' => '', 'template' => '', 'list' => $slugs),
|
||||
'music' => array('name' => 'Music', 'description' => '', 'template' => '', 'list' => array()),
|
||||
'videos' => array('name' => 'Videos', 'description' => '', 'template' => '', 'list' => array())
|
||||
);
|
||||
file_put_contents(PATH_DATABASES.'categories.php', $dataHead.json_encode($data, JSON_PRETTY_PRINT), LOCK_EX);
|
||||
file_put_contents(PATH_DATABASES . 'categories.php', $dataHead . json_encode($data, JSON_PRETTY_PRINT), LOCK_EX);
|
||||
|
||||
// File tags.php
|
||||
$data = array();
|
||||
file_put_contents(PATH_DATABASES.'tags.php', $dataHead.json_encode($data, JSON_PRETTY_PRINT), LOCK_EX);
|
||||
file_put_contents(PATH_DATABASES . 'tags.php', $dataHead . json_encode($data, JSON_PRETTY_PRINT), LOCK_EX);
|
||||
|
||||
// File plugins/about/db.php
|
||||
file_put_contents(
|
||||
PATH_PLUGINS_DATABASES.'about'.DS.'db.php',
|
||||
$dataHead.json_encode(
|
||||
PATH_PLUGINS_DATABASES . 'about' . DS . 'db.php',
|
||||
$dataHead . json_encode(
|
||||
array(
|
||||
'position'=>1,
|
||||
'label'=>$L->get('About'),
|
||||
'text'=>$L->get('this-is-a-brief-description-of-yourself-our-your-site')
|
||||
'position' => 1,
|
||||
'label' => $L->get('About'),
|
||||
'text' => $L->get('this-is-a-brief-description-of-yourself-our-your-site')
|
||||
),
|
||||
JSON_PRETTY_PRINT),
|
||||
JSON_PRETTY_PRINT
|
||||
),
|
||||
LOCK_EX
|
||||
);
|
||||
|
||||
// File plugins/simple-stats/db.php
|
||||
// File plugins/visits-stats/db.php
|
||||
file_put_contents(
|
||||
PATH_PLUGINS_DATABASES.'simple-stats'.DS.'db.php',
|
||||
$dataHead.json_encode(
|
||||
PATH_PLUGINS_DATABASES . 'visits-stats' . DS . 'db.php',
|
||||
$dataHead . json_encode(
|
||||
array(
|
||||
'numberOfDays'=>7,
|
||||
'label'=>$L->get('Visits'),
|
||||
'excludeAdmins'=>false,
|
||||
'position'=>1
|
||||
'numberOfDays' => 7,
|
||||
'label' => $L->get('Visits'),
|
||||
'excludeAdmins' => false,
|
||||
'position' => 1
|
||||
),
|
||||
JSON_PRETTY_PRINT),
|
||||
JSON_PRETTY_PRINT
|
||||
),
|
||||
LOCK_EX
|
||||
);
|
||||
mkdir(PATH_WORKSPACES.'simple-stats', DIR_PERMISSIONS, true);
|
||||
mkdir(PATH_WORKSPACES . 'visits-stats', DIR_PERMISSIONS, true);
|
||||
|
||||
// File plugins/tinymce/db.php
|
||||
file_put_contents(
|
||||
PATH_PLUGINS_DATABASES.'tinymce'.DS.'db.php',
|
||||
$dataHead.json_encode(
|
||||
PATH_PLUGINS_DATABASES . 'tinymce' . DS . 'db.php',
|
||||
$dataHead . json_encode(
|
||||
array(
|
||||
'position'=>1,
|
||||
'toolbar1'=>'formatselect bold italic forecolor backcolor removeformat | bullist numlist table | blockquote alignleft aligncenter alignright | link unlink pagebreak image code',
|
||||
'toolbar2'=>'',
|
||||
'plugins'=>'code autolink image link pagebreak advlist lists textpattern table'
|
||||
'position' => 1,
|
||||
'toolbar1' => 'formatselect bold italic forecolor backcolor removeformat | bullist numlist table | blockquote alignleft aligncenter alignright | link unlink pagebreak image code',
|
||||
'toolbar2' => '',
|
||||
'plugins' => 'code autolink image link pagebreak advlist lists textpattern table'
|
||||
),
|
||||
JSON_PRETTY_PRINT),
|
||||
JSON_PRETTY_PRINT
|
||||
),
|
||||
LOCK_EX
|
||||
);
|
||||
|
||||
// File plugins/canonical/db.php
|
||||
file_put_contents(
|
||||
PATH_PLUGINS_DATABASES.'canonical'.DS.'db.php',
|
||||
$dataHead.json_encode(
|
||||
PATH_PLUGINS_DATABASES . 'canonical' . DS . 'db.php',
|
||||
$dataHead . json_encode(
|
||||
array(
|
||||
'position'=>1
|
||||
'position' => 1
|
||||
),
|
||||
JSON_PRETTY_PRINT),
|
||||
JSON_PRETTY_PRINT
|
||||
),
|
||||
LOCK_EX
|
||||
);
|
||||
|
||||
// File plugins/robots/db.php
|
||||
file_put_contents(
|
||||
PATH_PLUGINS_DATABASES.'robots'.DS.'db.php',
|
||||
$dataHead.json_encode(
|
||||
PATH_PLUGINS_DATABASES . 'robots' . DS . 'db.php',
|
||||
$dataHead . json_encode(
|
||||
array(
|
||||
'position'=>1,
|
||||
'robotstxt'=>'User-agent: *'.PHP_EOL.'Allow: /'
|
||||
'position' => 1,
|
||||
'robotstxt' => 'User-agent: *' . PHP_EOL . 'Allow: /'
|
||||
),
|
||||
JSON_PRETTY_PRINT),
|
||||
JSON_PRETTY_PRINT
|
||||
),
|
||||
LOCK_EX
|
||||
);
|
||||
|
||||
// File plugins/welcome/db.php
|
||||
file_put_contents(
|
||||
PATH_PLUGINS_DATABASES . 'welcome' . DS . 'db.php',
|
||||
$dataHead . json_encode(
|
||||
array(
|
||||
'position' => 1
|
||||
),
|
||||
JSON_PRETTY_PRINT
|
||||
),
|
||||
LOCK_EX
|
||||
);
|
||||
|
||||
// File plugins/visits-stats/db.php
|
||||
file_put_contents(
|
||||
PATH_PLUGINS_DATABASES . 'visits-stats' . DS . 'db.php',
|
||||
$dataHead . json_encode(
|
||||
array(
|
||||
'position' => 2,
|
||||
'excludeAdmins' => false,
|
||||
'label' => $L->get('Visits')
|
||||
),
|
||||
JSON_PRETTY_PRINT
|
||||
),
|
||||
LOCK_EX
|
||||
);
|
||||
|
||||
// File plugins/popeye/db.php
|
||||
file_put_contents(
|
||||
PATH_PLUGINS_DATABASES . 'popeye' . DS . 'db.php',
|
||||
$dataHead . json_encode(
|
||||
array(
|
||||
"googleFonts"=> false,
|
||||
"darkMode"=> true,
|
||||
"dateFormat"=> "relative",
|
||||
"showTags"=> true,
|
||||
"position"=> 1
|
||||
),
|
||||
JSON_PRETTY_PRINT
|
||||
),
|
||||
LOCK_EX
|
||||
);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
function redirect($url) {
|
||||
function redirect($url)
|
||||
{
|
||||
if (!headers_sent()) {
|
||||
header("Location:".$url, TRUE, 302);
|
||||
exit;
|
||||
header("Location:" . $url, TRUE, 302);
|
||||
exit(0);
|
||||
}
|
||||
|
||||
exit('<meta http-equiv="refresh" content="0; url="'.$url.'">');
|
||||
exit('<meta http-equiv="refresh" content="0; url="' . $url . '">');
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
|
@ -551,7 +595,7 @@ function redirect($url) {
|
|||
|
||||
if (alreadyInstalled()) {
|
||||
$errorText = 'Bludit is already installed ;)';
|
||||
error_log('[ERROR] '.$errorText, 0);
|
||||
error_log('[ERROR] ' . $errorText, 0);
|
||||
exit($errorText);
|
||||
}
|
||||
|
||||
|
@ -563,18 +607,14 @@ if (isset($_GET['demo'])) {
|
|||
|
||||
// Install by POST method
|
||||
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
|
||||
if (Text::length($_POST['password'])<6) {
|
||||
$errorText = $L->g('password-must-be-at-least-6-characters-long');
|
||||
error_log('[ERROR] '.$errorText, 0);
|
||||
} else {
|
||||
install($_POST['password'], $_POST['timezone']);
|
||||
redirect(HTML_PATH_ROOT);
|
||||
}
|
||||
install($_POST['password'], $_POST['timezone']);
|
||||
redirect(HTML_PATH_ROOT);
|
||||
}
|
||||
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<html class="h-100">
|
||||
|
||||
<head>
|
||||
<title><?php echo $L->get('Bludit Installer') ?></title>
|
||||
<meta charset="<?php echo CHARSET ?>">
|
||||
|
@ -585,107 +625,102 @@ if ($_SERVER['REQUEST_METHOD'] == 'POST') {
|
|||
<link rel="icon" type="image/png" href="bl-kernel/img/favicon.png?version=<?php echo time() ?>">
|
||||
|
||||
<!-- CSS -->
|
||||
<link rel="stylesheet" type="text/css" href="bl-kernel/css/bootstrap.min.css?version=<?php echo time() ?>">
|
||||
<link rel="stylesheet" type="text/css" href="bl-kernel/admin/themes/booty/css/bludit.css?version=<?php echo time() ?>">
|
||||
<link rel="stylesheet" type="text/css" href="bl-kernel/vendors/bootstrap/bootstrap.min.css?version=<?php echo time() ?>">
|
||||
|
||||
<!-- Javascript -->
|
||||
<script charset="utf-8" src="bl-kernel/js/jquery.min.js?version=<?php echo time() ?>"></script>
|
||||
<script charset="utf-8" src="bl-kernel/js/bootstrap.bundle.min.js?version=<?php echo time() ?>"></script>
|
||||
<script charset="utf-8" src="bl-kernel/js/jstz.min.js?version=<?php echo time() ?>"></script>
|
||||
<script charset="utf-8" src="bl-kernel/vendors/jquery/jquery.min.js?version=<?php echo time() ?>"></script>
|
||||
<script charset="utf-8" src="bl-kernel/vendors/bootstrap/bootstrap.bundle.min.js?version=<?php echo time() ?>"></script>
|
||||
<script charset="utf-8" src="bl-kernel/vendors/jstimezonedetect/jstz.min.js?version=<?php echo time() ?>"></script>
|
||||
</head>
|
||||
<body class="login">
|
||||
<div class="container">
|
||||
<div class="row justify-content-md-center pt-5">
|
||||
<div class="col-md-4 pt-5">
|
||||
<h1 class="text-center mb-5 mt-5 fw-normal text-uppercase" style="color: #555;"><?php echo $L->get('Bludit Installer') ?></h1>
|
||||
<?php
|
||||
$system = checkSystem();
|
||||
if (!empty($system)) {
|
||||
foreach ($system as $error) {
|
||||
echo '
|
||||
<table class="table">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th>'.$error.'</th>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
';
|
||||
|
||||
<body class="h-100 bg-light">
|
||||
<div class="container h-100">
|
||||
<div class="row h-100 justify-content-center align-items-center">
|
||||
<div class="col-8 col-md-6 col-lg-4">
|
||||
<h1 class="text-center text-uppercase mb-4"><?php echo $L->get('Bludit Installer') ?></h1>
|
||||
<?php
|
||||
$system = checkSystem();
|
||||
if (!empty($system)) {
|
||||
foreach ($system as $error) {
|
||||
echo '
|
||||
<table class="table">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th>' . $error . '</th>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
';
|
||||
}
|
||||
} elseif (isset($_GET['language'])) {
|
||||
?>
|
||||
<p><?php echo $L->get('choose-a-password-for-the-user-admin') ?></p>
|
||||
|
||||
<?php if (!empty($errorText)) : ?>
|
||||
<div class="alert alert-danger"><?php echo $errorText ?></div>
|
||||
<?php endif ?>
|
||||
|
||||
<form id="jsformInstaller" method="post" action="" autocomplete="off">
|
||||
<input type="hidden" name="timezone" id="jstimezone" value="UTC">
|
||||
|
||||
<div class="form-group">
|
||||
<input type="text" value="admin" class="form-control form-control-lg" id="jsusername" name="username" placeholder="Username" disabled>
|
||||
</div>
|
||||
|
||||
<div class="form-group mb-0">
|
||||
<input type="password" class="form-control form-control-lg" id="jspassword" name="password" placeholder="<?php $L->p('Password') ?>">
|
||||
</div>
|
||||
<!-- <div id="jsshowPassword" style="cursor: pointer;" class="text-center pt-0 text-muted"><?php $L->p('Show password') ?></div> -->
|
||||
|
||||
<div class="form-group mt-4">
|
||||
<button type="submit" class="btn btn-primary btn-lg me-2 w-100" name="install"><?php $L->p('Install') ?></button>
|
||||
</div>
|
||||
</form>
|
||||
<?php
|
||||
} else {
|
||||
?>
|
||||
<form id="jsformLanguage" method="get" action="" autocomplete="off">
|
||||
<label for="jslanguage"><?php echo $L->get('Choose your language') ?></label>
|
||||
<select id="jslanguage" name="language" class="form-control form-control-lg">
|
||||
<?php
|
||||
$htmlOptions = getLanguageList();
|
||||
foreach ($htmlOptions as $fname => $native) {
|
||||
echo '<option value="' . $fname . '"' . (($finalLanguage === $fname) ? ' selected="selected"' : '') . '>' . $native . '</option>';
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
|
||||
<div class="form-group mt-4">
|
||||
<button type="submit" class="btn btn-primary btn-lg me-2 w-100"><?php $L->p('Next') ?></button>
|
||||
</div>
|
||||
</form>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
elseif (isset($_GET['language']))
|
||||
{
|
||||
?>
|
||||
<p><?php echo $L->get('choose-a-password-for-the-user-admin') ?></p>
|
||||
|
||||
<?php if (!empty($errorText)): ?>
|
||||
<div class="alert alert-danger"><?php echo $errorText ?></div>
|
||||
<?php endif ?>
|
||||
|
||||
<form id="jsformInstaller" method="post" action="" autocomplete="off">
|
||||
<input type="hidden" name="timezone" id="jstimezone" value="UTC">
|
||||
|
||||
<div class="form-group">
|
||||
<input type="text" value="admin" class="form-control form-control-lg" id="jsusername" name="username" placeholder="Username" disabled>
|
||||
</div>
|
||||
|
||||
<div class="form-group mb-0">
|
||||
<input type="password" class="form-control form-control-lg" id="jspassword" name="password" placeholder="<?php $L->p('Password') ?>">
|
||||
</div>
|
||||
<div id="jsshowPassword" style="cursor: pointer;" class="text-center pt-0 text-muted"><?php $L->p('Show password') ?></div>
|
||||
|
||||
<div class="form-group mt-4">
|
||||
<button type="submit" class="btn btn-primary btn-lg me-2 w-100" name="install"><?php $L->p('Install') ?></button>
|
||||
</div>
|
||||
</form>
|
||||
<?php
|
||||
}
|
||||
else
|
||||
{
|
||||
?>
|
||||
<form id="jsformLanguage" method="get" action="" autocomplete="off">
|
||||
<label for="jslanguage"><?php echo $L->get('Choose your language') ?></label>
|
||||
<select id="jslanguage" name="language" class="form-control form-control-lg">
|
||||
<?php
|
||||
$htmlOptions = getLanguageList();
|
||||
foreach($htmlOptions as $fname=>$native) {
|
||||
echo '<option value="'.$fname.'"'.( ($finalLanguage===$fname)?' selected="selected"':'').'>'.$native.'</option>';
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
|
||||
<div class="form-group mt-4">
|
||||
<button type="submit" class="btn btn-primary btn-lg me-2 w-100"><?php $L->p('Next') ?></button>
|
||||
</div>
|
||||
</form>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
$(document).ready(function()
|
||||
{
|
||||
// Timezone
|
||||
var timezone = jstz.determine();
|
||||
$("#jstimezone").val( timezone.name() );
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
// Timezone
|
||||
var timezone = jstz.determine();
|
||||
$("#jstimezone").val(timezone.name());
|
||||
|
||||
// Show password
|
||||
$("#jsshowPassword").on("click", function() {
|
||||
var input = document.getElementById("jspassword");
|
||||
// Show password
|
||||
$("#jsshowPassword").on("click", function() {
|
||||
var input = document.getElementById("jspassword");
|
||||
|
||||
if(input.getAttribute("type")=="text") {
|
||||
input.setAttribute("type", "password");
|
||||
}
|
||||
else {
|
||||
input.setAttribute("type", "text");
|
||||
}
|
||||
});
|
||||
if (input.getAttribute("type") == "text") {
|
||||
input.setAttribute("type", "password");
|
||||
} else {
|
||||
input.setAttribute("type", "text");
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
</script>
|
||||
});
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
</html>
|
Loading…
Add table
Reference in a new issue