commit
359804abb8
|
@ -1,7 +1,5 @@
|
|||
.DS_Store
|
||||
!themes/pure
|
||||
themes/*
|
||||
content/databases
|
||||
content/pages
|
||||
content/posts
|
||||
content/uploads
|
||||
bl-content/databases
|
||||
bl-content/pages
|
||||
bl-content/posts
|
||||
bl-content/uploads
|
||||
|
|
14
README.md
14
README.md
|
@ -1,8 +1,8 @@
|
|||
[Bludit](http://www.bludit.com/) — Flat file CMS
|
||||
================================================
|
||||
Create your own Blog in seconds.
|
||||
[Bludit](http://www.bludit.com/)
|
||||
================================
|
||||
**Fast**, **simple**, **extensible** and **flat file** CMS.
|
||||
|
||||
Fast, simple, extensible and Flat file CMS.
|
||||
Bludit is a simple web application to make your own **blog** or **site** in seconds, it's completly **free and open source**. Bludit uses flat-files (text files in JSON format) to store the posts and pages, you don't need to install or configure a database.
|
||||
|
||||
- [Documentation](http://docs.bludit.com)
|
||||
- [Help and Support](http://forum.bludit.com)
|
||||
|
@ -10,13 +10,13 @@ Fast, simple, extensible and Flat file CMS.
|
|||
- [Themes](https://github.com/dignajar/bludit-themes)
|
||||
- [More plugins and themes](http://forum.bludit.com/viewforum.php?f=14)
|
||||
|
||||
Social
|
||||
------
|
||||
Social networks
|
||||
---------------
|
||||
|
||||
- [Twitter](https://twitter.com/bludit)
|
||||
- [Facebook](https://www.facebook.com/bluditcms)
|
||||
- [Google+](https://plus.google.com/+Bluditcms)
|
||||
- [Freenode IRC](https://webchat.freenode.net) channel #bludit
|
||||
- [Freenode IRC](https://webchat.freenode.net) channel **#bludit**
|
||||
|
||||
[![Join the chat at https://gitter.im/dignajar/bludit](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/dignajar/bludit?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
||||
|
||||
|
|
|
@ -40,10 +40,6 @@ class dbJSON
|
|||
$this->dbBackup = $array;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Log::set(__METHOD__.LOG_SEP.'File '.$file.' does not exists');
|
||||
}
|
||||
}
|
||||
|
||||
public function restoreDB()
|
||||
|
@ -58,6 +54,7 @@ class dbJSON
|
|||
return count($this->db);
|
||||
}
|
||||
|
||||
// Returns the value from the field.
|
||||
public function getField($field)
|
||||
{
|
||||
if(isset($this->db[$field])) {
|
||||
|
@ -86,24 +83,24 @@ class dbJSON
|
|||
return file_put_contents($this->file, $data, LOCK_EX);
|
||||
}
|
||||
|
||||
// Returns a JSON encoded string on success or FALSE on failure.
|
||||
private function serialize($data)
|
||||
{
|
||||
// DEBUG: La idea es siempre serializar en json, habria que ver si siempre esta cargado json_enconde y decode
|
||||
if(JSON) {
|
||||
return json_encode($data, JSON_PRETTY_PRINT);
|
||||
}
|
||||
|
||||
return serialize($data);
|
||||
return json_encode($data, JSON_PRETTY_PRINT);
|
||||
}
|
||||
|
||||
// Returns the value encoded in json in appropriate PHP type.
|
||||
private function unserialize($data)
|
||||
{
|
||||
// DEBUG: La idea es siempre serializar en json, habria que ver si siempre esta cargado json_enconde y decode
|
||||
if(JSON) {
|
||||
return json_decode($data, true);
|
||||
// NULL is returned if the json cannot be decoded.
|
||||
$decode = json_decode($data, true);
|
||||
|
||||
// If NULL returns false.
|
||||
if(empty($decode)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return unserialize($data);
|
||||
return $decode;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -8,6 +8,8 @@ class Plugin {
|
|||
// (string) Database path and filename
|
||||
public $filenameDb;
|
||||
|
||||
public $filenameMetadata;
|
||||
|
||||
// (array) Database unserialized
|
||||
public $db;
|
||||
|
||||
|
@ -18,20 +20,10 @@ class Plugin {
|
|||
public $className;
|
||||
|
||||
// (array) Plugin's information.
|
||||
public $data;
|
||||
public $metadata;
|
||||
|
||||
function __construct()
|
||||
{
|
||||
$this->data = array(
|
||||
'name'=>'',
|
||||
'description'=>'',
|
||||
'author'=>'',
|
||||
'email'=>'',
|
||||
'website'=>'',
|
||||
'version'=>'',
|
||||
'releaseDate'=>''
|
||||
);
|
||||
|
||||
$this->dbFields = array();
|
||||
|
||||
$reflector = new ReflectionClass(get_class($this));
|
||||
|
@ -50,7 +42,12 @@ class Plugin {
|
|||
|
||||
$this->filenameDb = PATH_PLUGINS_DATABASES.$this->directoryName.DS.'db.php';
|
||||
|
||||
// If the plugin installed then get the database.
|
||||
// --- Metadata ---
|
||||
$this->filenameMetadata = PATH_PLUGINS.$this->directoryName().DS.'metadata.json';
|
||||
$metadataString = file_get_contents($this->filenameMetadata);
|
||||
$this->metadata = json_decode($metadataString, true);
|
||||
|
||||
// If the plugin is installed then get the database.
|
||||
if($this->installed())
|
||||
{
|
||||
$Tmp = new dbJSON($this->filenameDb);
|
||||
|
@ -74,18 +71,19 @@ class Plugin {
|
|||
}
|
||||
|
||||
// Returns the item from plugin-data.
|
||||
public function getData($key)
|
||||
public function getMetadata($key)
|
||||
{
|
||||
if(isset($this->data[$key])) {
|
||||
return $this->data[$key];
|
||||
if(isset($this->metadata[$key])) {
|
||||
return $this->metadata[$key];
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
public function setData($array)
|
||||
public function setMetadata($key, $value)
|
||||
{
|
||||
$this->data = $array;
|
||||
$this->metadata[$key] = $value;
|
||||
return true;
|
||||
}
|
||||
|
||||
public function getDbField($key, $html=true)
|
||||
|
@ -124,37 +122,37 @@ class Plugin {
|
|||
|
||||
public function name()
|
||||
{
|
||||
return $this->getData('name');
|
||||
return $this->getMetadata('name');
|
||||
}
|
||||
|
||||
public function description()
|
||||
{
|
||||
return $this->getData('description');
|
||||
return $this->getMetadata('description');
|
||||
}
|
||||
|
||||
public function author()
|
||||
{
|
||||
return $this->getData('author');
|
||||
return $this->getMetadata('author');
|
||||
}
|
||||
|
||||
public function email()
|
||||
{
|
||||
return $this->getData('email');
|
||||
return $this->getMetadata('email');
|
||||
}
|
||||
|
||||
public function website()
|
||||
{
|
||||
return $this->getData('website');
|
||||
return $this->getMetadata('website');
|
||||
}
|
||||
|
||||
public function version()
|
||||
{
|
||||
return $this->getData('version');
|
||||
return $this->getMetadata('version');
|
||||
}
|
||||
|
||||
public function releaseDate()
|
||||
{
|
||||
return $this->getData('releaseDate');
|
||||
return $this->getMetadata('releaseDate');
|
||||
}
|
||||
|
||||
public function className()
|
|
@ -6,10 +6,23 @@
|
|||
function updateBludit()
|
||||
{
|
||||
global $Site;
|
||||
global $dbPosts;
|
||||
|
||||
// Check if Bludit need to be update.
|
||||
if( ($Site->currentBuild() < BLUDIT_BUILD) || isset($_GET['update']) )
|
||||
{
|
||||
// --- Update dates ---
|
||||
foreach($dbPosts->db as $key=>$post)
|
||||
{
|
||||
$date = Date::format($post['date'], 'Y-m-d H:i', DB_DATE_FORMAT);
|
||||
if($date !== false) {
|
||||
$dbPosts->setPostDb($key,'date',$date);
|
||||
}
|
||||
}
|
||||
|
||||
$dbPosts->save();
|
||||
|
||||
// --- Update directories ---
|
||||
$directories = array(
|
||||
PATH_POSTS,
|
||||
PATH_PAGES,
|
|
@ -21,30 +21,4 @@ if($Login->role()!=='admin') {
|
|||
// Main after POST
|
||||
// ============================================================================
|
||||
|
||||
$themes = array();
|
||||
$themesPaths = Filesystem::listDirectories(PATH_THEMES);
|
||||
|
||||
foreach($themesPaths as $themePath)
|
||||
{
|
||||
$langLocaleFile = $themePath.DS.'languages'.DS.$Site->locale().'.json';
|
||||
$langDefaultFile = $themePath.DS.'languages'.DS.'en_US.json';
|
||||
|
||||
// Check if exists default language
|
||||
if( Sanitize::pathFile($langDefaultFile) )
|
||||
{
|
||||
$database = new dbJSON($langDefaultFile, false);
|
||||
$databaseArray = $database->db;
|
||||
$themeMetaData = $database->db['theme-data'];
|
||||
|
||||
// Check if exists locale language
|
||||
if( Sanitize::pathFile($langLocaleFile) ) {
|
||||
$database = new dbJSON($langLocaleFile, false);
|
||||
$themeMetaData = array_merge($themeMetaData, $database->db['theme-data']);
|
||||
}
|
||||
|
||||
$themeMetaData['dirname'] = basename($themePath);
|
||||
|
||||
// Theme data
|
||||
array_push($themes, $themeMetaData);
|
||||
}
|
||||
}
|
||||
$themes = buildThemes();
|
|
@ -179,6 +179,19 @@ button.delete-button:hover {
|
|||
text-transform: uppercase;
|
||||
}
|
||||
|
||||
#jstagList {
|
||||
margin-top: 5px;
|
||||
}
|
||||
|
||||
#jstagList span {
|
||||
background: #f1f1f1;
|
||||
border-radius: 3px;
|
||||
color: #2672ec;
|
||||
margin-right: 5px;
|
||||
padding: 3px 10px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
/* ----------- BLUDIT IMAGES V8 ----------- */
|
||||
#bludit-images-v8 {
|
||||
|
||||
|
@ -340,6 +353,11 @@ h3.titleOptions {
|
|||
|
||||
/* ----------- PLUGIN LIST / THEME LIST ----------- */
|
||||
|
||||
tr.plugin-installed,
|
||||
tr.theme-installed {
|
||||
background: #F2F7FF !important;
|
||||
}
|
||||
|
||||
div.plugin-links > a {
|
||||
display: inline-block;
|
||||
margin-top: 5px;
|
File diff suppressed because one or more lines are too long
0
kernel/admin/themes/default/css/fonts/FontAwesome.otf → bl-kernel/admin/themes/default/css/fonts/FontAwesome.otf
Executable file → Normal file
0
kernel/admin/themes/default/css/fonts/FontAwesome.otf → bl-kernel/admin/themes/default/css/fonts/FontAwesome.otf
Executable file → Normal file
0
kernel/admin/themes/default/css/fonts/fontawesome-webfont.ttf → bl-kernel/admin/themes/default/css/fonts/fontawesome-webfont.ttf
Executable file → Normal file
0
kernel/admin/themes/default/css/fonts/fontawesome-webfont.ttf → bl-kernel/admin/themes/default/css/fonts/fontawesome-webfont.ttf
Executable file → Normal file
0
kernel/admin/themes/default/css/jquery.auto-complete.css → bl-kernel/admin/themes/default/css/jquery.auto-complete.css
Executable file → Normal file
0
kernel/admin/themes/default/css/jquery.auto-complete.css → bl-kernel/admin/themes/default/css/jquery.auto-complete.css
Executable file → Normal file
0
kernel/admin/themes/default/css/uikit/form-file.almost-flat.min.css → bl-kernel/admin/themes/default/css/uikit/form-file.almost-flat.min.css
vendored
Executable file → Normal file
0
kernel/admin/themes/default/css/uikit/form-file.almost-flat.min.css → bl-kernel/admin/themes/default/css/uikit/form-file.almost-flat.min.css
vendored
Executable file → Normal file
0
kernel/admin/themes/default/css/uikit/placeholder.almost-flat.min.css → bl-kernel/admin/themes/default/css/uikit/placeholder.almost-flat.min.css
vendored
Executable file → Normal file
0
kernel/admin/themes/default/css/uikit/placeholder.almost-flat.min.css → bl-kernel/admin/themes/default/css/uikit/placeholder.almost-flat.min.css
vendored
Executable file → Normal file
0
kernel/admin/themes/default/css/uikit/progress.almost-flat.min.css → bl-kernel/admin/themes/default/css/uikit/progress.almost-flat.min.css
vendored
Executable file → Normal file
0
kernel/admin/themes/default/css/uikit/progress.almost-flat.min.css → bl-kernel/admin/themes/default/css/uikit/progress.almost-flat.min.css
vendored
Executable file → Normal file
0
kernel/admin/themes/default/css/uikit/uikit.almost-flat.min.css → bl-kernel/admin/themes/default/css/uikit/uikit.almost-flat.min.css
vendored
Executable file → Normal file
0
kernel/admin/themes/default/css/uikit/uikit.almost-flat.min.css → bl-kernel/admin/themes/default/css/uikit/uikit.almost-flat.min.css
vendored
Executable file → Normal file
0
kernel/admin/themes/default/css/uikit/upload.almost-flat.min.css → bl-kernel/admin/themes/default/css/uikit/upload.almost-flat.min.css
vendored
Executable file → Normal file
0
kernel/admin/themes/default/css/uikit/upload.almost-flat.min.css → bl-kernel/admin/themes/default/css/uikit/upload.almost-flat.min.css
vendored
Executable file → Normal file
Before Width: | Height: | Size: 2.6 KiB After Width: | Height: | Size: 2.6 KiB |
Before Width: | Height: | Size: 1005 B After Width: | Height: | Size: 1005 B |
|
@ -20,7 +20,22 @@ class HTML {
|
|||
public static function formClose()
|
||||
{
|
||||
$html = '</form>';
|
||||
echo $html;
|
||||
|
||||
$script = '<script>
|
||||
|
||||
$(document).ready(function() {
|
||||
|
||||
// Prevent the form submit when press enter key.
|
||||
$("form").keypress(function(e) {
|
||||
if (e.which == 13) {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
</script>';
|
||||
echo $html.$script;
|
||||
}
|
||||
|
||||
// label, name, value, tip
|
||||
|
@ -52,22 +67,104 @@ class HTML {
|
|||
echo $html;
|
||||
}
|
||||
|
||||
public static function formInputAutocomplete($args)
|
||||
public static function tagsAutocomplete($args)
|
||||
{
|
||||
// Tag array for Javascript
|
||||
$tagArray = 'var tagArray = [];';
|
||||
if(!empty($args['value'])) {
|
||||
$tagArray = 'var tagArray = ["'.implode('","', $args['value']).'"]';
|
||||
}
|
||||
$args['value'] = '';
|
||||
|
||||
// Text input
|
||||
self::formInputText($args);
|
||||
|
||||
echo '<div id="jstagList"></div>';
|
||||
|
||||
$script = '<script>
|
||||
$("input[name=\"'.$args['name'].'\"]").autoComplete({
|
||||
minChars: 1,
|
||||
source: function(term, suggest){
|
||||
term = term.toLowerCase();
|
||||
var choices = ['.$args['words'].'];
|
||||
var matches = [];
|
||||
for (i=0; i<choices.length; i++)
|
||||
if (~choices[i].toLowerCase().indexOf(term)) matches.push(choices[i]);
|
||||
suggest(matches);
|
||||
}
|
||||
|
||||
'.$tagArray.'
|
||||
|
||||
function insertTag(tag)
|
||||
{
|
||||
// Clean the input text
|
||||
$("#jstags").val("");
|
||||
|
||||
if(tag.trim()=="") {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Check if the tag is already inserted.
|
||||
var found = $.inArray(tag, tagArray);
|
||||
if(found == -1) {
|
||||
tagArray.push(tag);
|
||||
renderTagList();
|
||||
}
|
||||
}
|
||||
|
||||
function removeTag(tag)
|
||||
{
|
||||
var found = $.inArray(tag, tagArray);
|
||||
|
||||
if(found => 0) {
|
||||
tagArray.splice(found, 1);
|
||||
renderTagList();
|
||||
}
|
||||
}
|
||||
|
||||
function renderTagList()
|
||||
{
|
||||
if(tagArray.length == 0) {
|
||||
$("#jstagList").html("");
|
||||
}
|
||||
else {
|
||||
$("#jstagList").html("<span>"+tagArray.join("</span><span>")+"</span>");
|
||||
}
|
||||
}
|
||||
|
||||
$("#jstags").autoComplete({
|
||||
minChars: 1,
|
||||
source: function(term, suggest){
|
||||
term = term.toLowerCase();
|
||||
var choices = ['.$args['words'].'];
|
||||
var matches = [];
|
||||
for (i=0; i<choices.length; i++)
|
||||
if (~choices[i].toLowerCase().indexOf(term)) matches.push(choices[i]);
|
||||
suggest(matches);
|
||||
},
|
||||
onSelect: function(e, value, item) {
|
||||
// Insert the tag when select whit the mouse click.
|
||||
insertTag(value);
|
||||
}
|
||||
});
|
||||
|
||||
$(document).ready(function() {
|
||||
|
||||
// When the page is loaded render the tags
|
||||
renderTagList();
|
||||
|
||||
// Remove the tag when click on it.
|
||||
$("body").on("click", "#jstagList > span", function() {
|
||||
value = $(this).html();
|
||||
removeTag(value);
|
||||
});
|
||||
|
||||
// Insert tag when press enter key.
|
||||
$("#jstags").keypress(function(e) {
|
||||
if (e.which == 13) {
|
||||
var value = $(this).val();
|
||||
insertTag(value);
|
||||
}
|
||||
});
|
||||
|
||||
// When form submit.
|
||||
$("form").submit(function(e) {
|
||||
var list = tagArray.join(",");
|
||||
$("#jstags").val(list);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
</script>';
|
||||
|
||||
echo $script;
|
||||
|
@ -157,7 +254,7 @@ $("input[name=\"'.$args['name'].'\"]").autoComplete({
|
|||
$html = '<!-- BLUDIT QUICK IMAGES -->';
|
||||
$html .= '
|
||||
<div id="bludit-quick-images">
|
||||
<div id="bludit-quick-images-thumbnails">
|
||||
<div id="bludit-quick-images-thumbnails" onmousedown="return false">
|
||||
';
|
||||
|
||||
$thumbnailList = Filesystem::listFiles(PATH_UPLOADS_THUMBNAILS,'*','*',true);
|
||||
|
@ -172,7 +269,7 @@ $html .= '
|
|||
';
|
||||
|
||||
if(empty($thumbnailList)) {
|
||||
$html .= '<div class="empty-images uk-block uk-text-center uk-block-muted">There are no images, upload someone to make your site more cheerful.</div>';
|
||||
$html .= '<div class="empty-images uk-block uk-text-center uk-block-muted">'.$L->g('There are no images').'</div>';
|
||||
}
|
||||
|
||||
$html .= '
|
||||
|
@ -345,7 +442,7 @@ $html .= '
|
|||
';
|
||||
|
||||
if(empty($thumbnailList)) {
|
||||
$html .= '<div class="empty-images uk-block uk-text-center uk-block-muted">There are no images, upload someone to make your site more cheerful.</div>';
|
||||
$html .= '<div class="empty-images uk-block uk-text-center uk-block-muted">'.$L->g('There are no images').'</div>';
|
||||
}
|
||||
|
||||
$html .= '
|
0
kernel/admin/themes/default/js/jquery.auto-complete.min.js → bl-kernel/admin/themes/default/js/jquery.auto-complete.min.js
vendored
Executable file → Normal file
0
kernel/admin/themes/default/js/jquery.auto-complete.min.js → bl-kernel/admin/themes/default/js/jquery.auto-complete.min.js
vendored
Executable file → Normal file
0
kernel/admin/themes/default/js/uikit/uikit.min.js → bl-kernel/admin/themes/default/js/uikit/uikit.min.js
vendored
Executable file → Normal file
0
kernel/admin/themes/default/js/uikit/uikit.min.js → bl-kernel/admin/themes/default/js/uikit/uikit.min.js
vendored
Executable file → Normal file
0
kernel/admin/themes/default/js/uikit/upload.min.js → bl-kernel/admin/themes/default/js/uikit/upload.min.js
vendored
Executable file → Normal file
0
kernel/admin/themes/default/js/uikit/upload.min.js → bl-kernel/admin/themes/default/js/uikit/upload.min.js
vendored
Executable file → Normal file
|
@ -77,11 +77,11 @@ echo '<div class="sidebar uk-width-large-2-10">';
|
|||
));
|
||||
|
||||
// Tags input
|
||||
HTML::formInputAutocomplete(array(
|
||||
HTML::tagsAutocomplete(array(
|
||||
'name'=>'tags',
|
||||
'value'=>$_Page->tags(),
|
||||
'value'=>$_Page->tags(true),
|
||||
'tip'=>$L->g('Type the tag and press enter'),
|
||||
'class'=>'uk-width-1-1 uk-form-large',
|
||||
'tip'=>$L->g('Write the tags separated by commas'),
|
||||
'label'=>$L->g('Tags'),
|
||||
'words'=>'"'.implode('", "', $dbTags->getAll()).'"'
|
||||
));
|
|
@ -71,11 +71,11 @@ echo '<div class="sidebar uk-width-large-2-10">';
|
|||
));
|
||||
|
||||
// Tags input
|
||||
HTML::formInputAutocomplete(array(
|
||||
HTML::tagsAutocomplete(array(
|
||||
'name'=>'tags',
|
||||
'value'=>$_Post->tags(),
|
||||
'value'=>$_Post->tags(true),
|
||||
'tip'=>$L->g('Type the tag and press enter'),
|
||||
'class'=>'uk-width-1-1 uk-form-large',
|
||||
'tip'=>$L->g('Write the tags separated by commas'),
|
||||
'label'=>$L->g('Tags'),
|
||||
'words'=>'"'.implode('", "', $dbTags->getAll()).'"'
|
||||
));
|
|
@ -64,11 +64,11 @@ echo '<div class="sidebar uk-width-large-2-10">';
|
|||
));
|
||||
|
||||
// Tags input
|
||||
HTML::formInputAutocomplete(array(
|
||||
HTML::tagsAutocomplete(array(
|
||||
'name'=>'tags',
|
||||
'value'=>'',
|
||||
'tip'=>$L->g('Type the tag and press enter'),
|
||||
'class'=>'uk-width-1-1 uk-form-large',
|
||||
'tip'=>$L->g('Write the tags separated by commas'),
|
||||
'label'=>$L->g('Tags'),
|
||||
'words'=>'"'.implode('", "', $dbTags->getAll()).'"'
|
||||
));
|
|
@ -64,11 +64,11 @@ echo '<div class="sidebar uk-width-large-2-10">';
|
|||
));
|
||||
|
||||
// Tags input
|
||||
HTML::formInputAutocomplete(array(
|
||||
HTML::tagsAutocomplete(array(
|
||||
'name'=>'tags',
|
||||
'value'=>'',
|
||||
'tip'=>$L->g('Type the tag and press enter'),
|
||||
'class'=>'uk-width-1-1 uk-form-large',
|
||||
'tip'=>$L->g('Write the tags separated by commas'),
|
||||
'label'=>$L->g('Tags'),
|
||||
'words'=>'"'.implode('", "', $dbTags->getAll()).'"'
|
||||
));
|
|
@ -3,7 +3,7 @@
|
|||
HTML::title(array('title'=>$L->g('Plugins'), 'icon'=>'puzzle-piece'));
|
||||
|
||||
echo '
|
||||
<table class="uk-table uk-table-striped">
|
||||
<table class="uk-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="uk-width-1-5">'.$L->g('Name').'</th>
|
||||
|
@ -18,7 +18,7 @@ echo '
|
|||
foreach($plugins['all'] as $Plugin)
|
||||
{
|
||||
echo '
|
||||
<tr>
|
||||
<tr '.($Plugin->installed()?'class="plugin-installed"':'class="plugin-notInstalled"').'>
|
||||
<td>
|
||||
<div class="plugin-name">'.$Plugin->name().'</div>
|
||||
<div class="plugin-links">
|
||||
|
@ -26,7 +26,7 @@ foreach($plugins['all'] as $Plugin)
|
|||
|
||||
if($Plugin->installed()) {
|
||||
if(method_exists($Plugin, 'form')) {
|
||||
echo '<a class="configure" href="'.HTML_PATH_ADMIN_ROOT.'configure-plugin/'.$Plugin->className().'">'.$L->g('Configure').'</a>';
|
||||
echo '<a class="configure" href="'.HTML_PATH_ADMIN_ROOT.'configure-plugin/'.$Plugin->className().'">'.$L->g('Settings').'</a>';
|
||||
echo '<span class="separator"> | </span>';
|
||||
}
|
||||
echo '<a class="uninstall" href="'.HTML_PATH_ADMIN_ROOT.'uninstall-plugin/'.$Plugin->className().'">'.$L->g('Deactivate').'</a>';
|
|
@ -3,7 +3,7 @@
|
|||
HTML::title(array('title'=>$L->g('Themes'), 'icon'=>'paint-brush'));
|
||||
|
||||
echo '
|
||||
<table class="uk-table uk-table-striped">
|
||||
<table class="uk-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="uk-width-1-5">'.$L->g('Name').'</th>
|
||||
|
@ -18,7 +18,7 @@ echo '
|
|||
foreach($themes as $theme)
|
||||
{
|
||||
echo '
|
||||
<tr>
|
||||
<tr '.($theme['dirname']==$Site->theme()?'class="theme-installed"':'class="theme-notInstalled"').'>
|
||||
<td>
|
||||
<div class="plugin-name">'.$theme['name'].'</div>
|
||||
<div class="plugin-links">
|
|
@ -23,4 +23,4 @@ elseif( $_POST['type']==='post' ) {
|
|||
|
||||
echo json_encode( array('slug'=>$slug) );
|
||||
|
||||
?>
|
||||
?>
|
|
@ -4,7 +4,7 @@
|
|||
define('BLUDIT_VERSION', 'githubVersion');
|
||||
define('BLUDIT_CODENAME', '');
|
||||
define('BLUDIT_RELEASE_DATE', '');
|
||||
define('BLUDIT_BUILD', '20151119');
|
||||
define('BLUDIT_BUILD', '20160122');
|
||||
|
||||
// Debug mode
|
||||
define('DEBUG_MODE', TRUE);
|
||||
|
@ -21,24 +21,28 @@ if(DEBUG_MODE)
|
|||
|
||||
// PHP paths
|
||||
// PATH_ROOT and PATH_BOOT are defined in index.php
|
||||
define('PATH_LANGUAGES', PATH_ROOT.'languages'.DS);
|
||||
define('PATH_THEMES', PATH_ROOT.'themes'.DS);
|
||||
define('PATH_PLUGINS', PATH_ROOT.'plugins'.DS);
|
||||
define('PATH_KERNEL', PATH_ROOT.'kernel'.DS);
|
||||
define('PATH_LANGUAGES', PATH_ROOT.'bl-languages'.DS);
|
||||
define('PATH_THEMES', PATH_ROOT.'bl-themes'.DS);
|
||||
define('PATH_PLUGINS', PATH_ROOT.'bl-plugins'.DS);
|
||||
define('PATH_KERNEL', PATH_ROOT.'bl-kernel'.DS);
|
||||
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_JS', PATH_KERNEL.'js'.DS);
|
||||
define('PATH_CONTENT', PATH_ROOT.'content'.DS);
|
||||
|
||||
define('PATH_POSTS', PATH_CONTENT.'posts'.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_UPLOADS', PATH_CONTENT.'uploads'.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);
|
||||
|
@ -76,7 +80,7 @@ define('NO_PARENT_CHAR', '3849abb4cb7abd24c2d8dac17b216f17');
|
|||
define('POSTS_PER_PAGE_ADMIN', 10);
|
||||
|
||||
// Check if JSON encode and decode are enabled.
|
||||
define('JSON', function_exists('json_encode'));
|
||||
// define('JSON', function_exists('json_encode'));
|
||||
|
||||
// TRUE if new posts hand-made set published, or FALSE for draft.
|
||||
define('CLI_STATUS', 'published');
|
||||
|
@ -132,7 +136,6 @@ include(PATH_KERNEL.'parsedown.class.php');
|
|||
include(PATH_KERNEL.'parsedownextra.class.php');
|
||||
include(PATH_KERNEL.'security.class.php');
|
||||
|
||||
|
||||
// Include Helpers Classes
|
||||
include(PATH_HELPERS.'text.class.php');
|
||||
include(PATH_HELPERS.'log.class.php');
|
||||
|
@ -152,7 +155,7 @@ include(PATH_HELPERS.'image.class.php');
|
|||
Session::start();
|
||||
if(Session::started()===false) {
|
||||
Log::set('init.php'.LOG_SEP.'Error occurred when trying to start the session.');
|
||||
exit('Bludit CMS. Failed to start session.');
|
||||
exit('Bludit. Failed to start session.');
|
||||
}
|
||||
|
||||
// Objects
|
||||
|
@ -165,7 +168,10 @@ $Url = new Url();
|
|||
$Parsedown = new ParsedownExtra();
|
||||
$Security = new Security();
|
||||
|
||||
// HTML PATHS
|
||||
// --- Relative paths ---
|
||||
// This paths are relative for the user / web browsing.
|
||||
|
||||
// Base URL
|
||||
// The user can define the base URL.
|
||||
// Left empty if you want to Bludit try to detect the base URL.
|
||||
$base = '';
|
||||
|
@ -188,30 +194,29 @@ else {
|
|||
$base = '/';
|
||||
}
|
||||
|
||||
define('HTML_PATH_ROOT', $base);
|
||||
|
||||
// Paths for themes
|
||||
define('HTML_PATH_THEMES', HTML_PATH_ROOT.'themes/');
|
||||
define('HTML_PATH_THEME', HTML_PATH_ROOT.'themes/'.$Site->theme().'/');
|
||||
define('HTML_PATH_ROOT', $base);
|
||||
define('HTML_PATH_THEMES', HTML_PATH_ROOT.'bl-themes/');
|
||||
define('HTML_PATH_THEME', HTML_PATH_THEMES.$Site->theme().'/');
|
||||
define('HTML_PATH_THEME_CSS', HTML_PATH_THEME.'css/');
|
||||
define('HTML_PATH_THEME_JS', HTML_PATH_THEME.'js/');
|
||||
define('HTML_PATH_THEME_IMG', HTML_PATH_THEME.'img/');
|
||||
|
||||
define('HTML_PATH_ADMIN_ROOT', HTML_PATH_ROOT.'admin/');
|
||||
define('HTML_PATH_ADMIN_THEME', HTML_PATH_ROOT.'kernel/admin/themes/'.$Site->adminTheme().'/');
|
||||
define('HTML_PATH_ADMIN_THEME', HTML_PATH_ROOT.'bl-kernel/admin/themes/'.$Site->adminTheme().'/');
|
||||
define('HTML_PATH_ADMIN_THEME_JS', HTML_PATH_ADMIN_THEME.'js/');
|
||||
define('HTML_PATH_ADMIN_THEME_CSS', HTML_PATH_ADMIN_THEME.'css/');
|
||||
define('HTML_PATH_ADMIN_THEME_IMG', HTML_PATH_ADMIN_THEME.'img/');
|
||||
|
||||
define('HTML_PATH_UPLOADS', HTML_PATH_ROOT.'content/uploads/');
|
||||
define('HTML_PATH_UPLOADS', HTML_PATH_ROOT.'bl-content/uploads/');
|
||||
define('HTML_PATH_UPLOADS_PROFILES', HTML_PATH_UPLOADS.'profiles/');
|
||||
define('HTML_PATH_UPLOADS_THUMBNAILS', HTML_PATH_UPLOADS.'thumbnails/');
|
||||
define('HTML_PATH_PLUGINS', HTML_PATH_ROOT.'plugins/');
|
||||
define('HTML_PATH_PLUGINS', HTML_PATH_ROOT.'bl-plugins/');
|
||||
|
||||
define('JQUERY', HTML_PATH_ADMIN_THEME_JS.'jquery.min.js');
|
||||
|
||||
// PHP paths with dependency
|
||||
define('PATH_THEME', PATH_ROOT.'themes'.DS.$Site->theme().DS);
|
||||
// --- PHP paths with dependency ---
|
||||
// This paths are absolutes for the OS.
|
||||
define('PATH_THEME', PATH_ROOT.'bl-themes'.DS.$Site->theme().DS);
|
||||
define('PATH_THEME_PHP', PATH_THEME.'php'.DS);
|
||||
define('PATH_THEME_CSS', PATH_THEME.'css'.DS);
|
||||
define('PATH_THEME_JS', PATH_THEME.'js'.DS);
|
||||
|
@ -219,6 +224,7 @@ define('PATH_THEME_IMG', PATH_THEME.'img'.DS);
|
|||
define('PATH_THEME_LANG', PATH_THEME.'languages'.DS);
|
||||
|
||||
// --- Absolute paths with domain ---
|
||||
// This paths are absolutes for the user / web browsing.
|
||||
define('DOMAIN', $Site->domain());
|
||||
define('DOMAIN_BASE', DOMAIN.HTML_PATH_ROOT);
|
||||
define('DOMAIN_THEME_CSS', DOMAIN.HTML_PATH_THEME_CSS);
|
|
@ -47,7 +47,7 @@ unset($pluginsEvents['all']);
|
|||
// Functions
|
||||
// ============================================================================
|
||||
|
||||
function build_plugins()
|
||||
function buildPlugins()
|
||||
{
|
||||
global $plugins;
|
||||
global $pluginsEvents;
|
||||
|
@ -72,26 +72,24 @@ function build_plugins()
|
|||
{
|
||||
$Plugin = new $pluginClass;
|
||||
|
||||
// Default language and meta data for the plugin
|
||||
$tmpMetaData = array();
|
||||
$languageFilename = PATH_PLUGINS.$Plugin->directoryName().DS.'languages'.DS.'en_US.json';
|
||||
$database = new dbJSON($languageFilename, false);
|
||||
$tmpMetaData = $database->db['plugin-data'];
|
||||
|
||||
// Check if the plugin is translated.
|
||||
$languageFilename = PATH_PLUGINS.$Plugin->directoryName().DS.'languages'.DS.$Site->locale().'.json';
|
||||
if( Sanitize::pathFile($languageFilename) )
|
||||
{
|
||||
$database = new dbJSON($languageFilename, false);
|
||||
$tmpMetaData = array_merge($tmpMetaData, $database->db['plugin-data']);
|
||||
if( !Sanitize::pathFile($languageFilename) ) {
|
||||
$languageFilename = PATH_PLUGINS.$Plugin->directoryName().DS.'languages'.DS.'en_US.json';
|
||||
}
|
||||
|
||||
// Set plugin meta data
|
||||
$Plugin->setData($tmpMetaData);
|
||||
$database = file_get_contents($languageFilename);
|
||||
$database = json_decode($database, true);
|
||||
|
||||
// Add words to language dictionary.
|
||||
unset($database->db['plugin-data']);
|
||||
$Language->add($database->db);
|
||||
// Set name and description from the language file.
|
||||
$Plugin->setMetadata('name',$database['plugin-data']['name']);
|
||||
$Plugin->setMetadata('description',$database['plugin-data']['description']);
|
||||
|
||||
// Remove name and description, and add new words if there are.
|
||||
unset($database['plugin-data']);
|
||||
if(!empty($database)) {
|
||||
$Language->add($database);
|
||||
}
|
||||
|
||||
// Push Plugin to array all plugins installed and not installed.
|
||||
$plugins['all'][$pluginClass] = $Plugin;
|
||||
|
@ -113,4 +111,4 @@ function build_plugins()
|
|||
// Main
|
||||
// ============================================================================
|
||||
|
||||
build_plugins();
|
||||
buildPlugins();
|
|
@ -9,6 +9,11 @@ if($Url->whereAmI()=='admin') {
|
|||
$postPerPage = POSTS_PER_PAGE_ADMIN;
|
||||
$numberOfPosts = $dbPosts->numberPost(true); // published and drafts
|
||||
}
|
||||
elseif($Url->whereAmI()=='tag') {
|
||||
$postPerPage = $Site->postsPerPage();
|
||||
$tagKey = $Url->slug();
|
||||
$numberOfPosts = $dbTags->countPostsByTag($tagKey);
|
||||
}
|
||||
else {
|
||||
$postPerPage = $Site->postsPerPage();
|
||||
$numberOfPosts = $dbPosts->numberPost(false); // published
|
|
@ -0,0 +1,84 @@
|
|||
<?php defined('BLUDIT') or die('Bludit CMS.');
|
||||
|
||||
// ============================================================================
|
||||
// Variables
|
||||
// ============================================================================
|
||||
|
||||
// ============================================================================
|
||||
// Functions
|
||||
// ============================================================================
|
||||
|
||||
function buildThemes()
|
||||
{
|
||||
global $Site;
|
||||
|
||||
$themes = array();
|
||||
$themesPaths = Filesystem::listDirectories(PATH_THEMES);
|
||||
|
||||
foreach($themesPaths as $themePath)
|
||||
{
|
||||
// Check if the theme is translated.
|
||||
$languageFilename = $themePath.DS.'languages'.DS.$Site->locale().'.json';
|
||||
if( !Sanitize::pathFile($languageFilename) ) {
|
||||
$languageFilename = $themePath.DS.'languages'.DS.'en_US.json';
|
||||
}
|
||||
|
||||
if( Sanitize::pathFile($languageFilename) )
|
||||
{
|
||||
$database = file_get_contents($languageFilename);
|
||||
$database = json_decode($database, true);
|
||||
if(empty($database)) {
|
||||
Log::set('99.themes.php'.LOG_SEP.'JSON Error on theme '.$themePath);
|
||||
break;
|
||||
}
|
||||
|
||||
$database = $database['theme-data'];
|
||||
|
||||
$database['dirname'] = basename($themePath);
|
||||
|
||||
// --- Metadata ---
|
||||
$filenameMetadata = $themePath.DS.'metadata.json';
|
||||
|
||||
if( Sanitize::pathFile($filenameMetadata) )
|
||||
{
|
||||
$metadataString = file_get_contents($filenameMetadata);
|
||||
$metadata = json_decode($metadataString, true);
|
||||
if(empty($metadata)) {
|
||||
Log::set('99.themes.php'.LOG_SEP.'JSON Error on theme '.$themePath);
|
||||
break;
|
||||
}
|
||||
|
||||
$database = $database + $metadata;
|
||||
|
||||
// Theme data
|
||||
array_push($themes, $database);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $themes;
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
// Main
|
||||
// ============================================================================
|
||||
|
||||
// Load the language file
|
||||
$languageFilename = PATH_THEME.DS.'languages'.DS.$Site->locale().'.json';
|
||||
if( !Sanitize::pathFile($languageFilename) ) {
|
||||
$languageFilename = PATH_THEME.DS.'languages'.DS.'en_US.json';
|
||||
}
|
||||
|
||||
if( Sanitize::pathFile($languageFilename) )
|
||||
{
|
||||
$database = file_get_contents($languageFilename);
|
||||
$database = json_decode($database, true);
|
||||
|
||||
// Remote the name and description.
|
||||
unset($database['theme-data']);
|
||||
|
||||
// Load words from the theme language
|
||||
if(!empty($database)) {
|
||||
$Language->add($database);
|
||||
}
|
||||
}
|
|
@ -14,7 +14,7 @@ class dbPages extends dbJSON
|
|||
'date'=> array('inFile'=>false, 'value'=>''),
|
||||
'position'=> array('inFile'=>false, 'value'=>0),
|
||||
'coverImage'=> array('inFile'=>false, 'value'=>''),
|
||||
'hash'=> array('inFile'=>false, 'value'=>'')
|
||||
'checksum'=> array('inFile'=>false, 'value'=>'')
|
||||
);
|
||||
|
||||
function __construct()
|
||||
|
@ -78,7 +78,7 @@ class dbPages extends dbJSON
|
|||
|
||||
// Create Hash
|
||||
$serialize = serialize($dataForDb+$dataForFile);
|
||||
$dataForDb['hash'] = sha1($serialize);
|
||||
$dataForDb['checksum'] = sha1($serialize);
|
||||
|
||||
// Make the directory. Recursive.
|
||||
if( Filesystem::mkdir(PATH_PAGES.$key, true) === false ) {
|
||||
|
@ -164,7 +164,7 @@ class dbPages extends dbJSON
|
|||
|
||||
// Create Hash
|
||||
$serialize = serialize($dataForDb+$dataForFile);
|
||||
$dataForDb['hash'] = sha1($serialize);
|
||||
$dataForDb['checksum'] = sha1($serialize);
|
||||
|
||||
// Move the directory from old key to new key.
|
||||
if($newKey!==$args['key'])
|
|
@ -12,7 +12,7 @@ class dbPosts extends dbJSON
|
|||
'allowComments'=> array('inFile'=>false, 'value'=>false),
|
||||
'date'=> array('inFile'=>false, 'value'=>''),
|
||||
'coverImage'=> array('inFile'=>false, 'value'=>''),
|
||||
'hash'=> array('inFile'=>false, 'value'=>'')
|
||||
'checksum'=> array('inFile'=>false, 'value'=>'')
|
||||
);
|
||||
|
||||
private $numberPosts = array(
|
||||
|
@ -110,12 +110,12 @@ class dbPosts extends dbJSON
|
|||
return false;
|
||||
}
|
||||
|
||||
// Date
|
||||
// If the date not valid, then set the current date.
|
||||
if(!Valid::date($args['date'], DB_DATE_FORMAT)) {
|
||||
$args['date'] = $currentDate;
|
||||
}
|
||||
|
||||
// Schedule post?
|
||||
// Schedule post ?
|
||||
if( ($args['date']>$currentDate) && ($args['status']=='published') ) {
|
||||
$args['status'] = 'scheduled';
|
||||
}
|
||||
|
@ -161,7 +161,7 @@ class dbPosts extends dbJSON
|
|||
|
||||
// Create Hash
|
||||
$serialize = serialize($dataForDb+$dataForFile);
|
||||
$dataForDb['hash'] = sha1($serialize);
|
||||
$dataForDb['checksum'] = sha1($serialize);
|
||||
|
||||
// Make the directory.
|
||||
if( Filesystem::mkdir(PATH_POSTS.$key) === false ) {
|
||||
|
@ -314,7 +314,7 @@ class dbPosts extends dbJSON
|
|||
|
||||
$saveDatabase = false;
|
||||
|
||||
// Check scheduled posts and publish.
|
||||
// Check scheduled posts
|
||||
foreach($this->db as $postKey=>$values)
|
||||
{
|
||||
if($values['status']=='scheduled')
|
||||
|
@ -330,7 +330,7 @@ class dbPosts extends dbJSON
|
|||
}
|
||||
}
|
||||
|
||||
// Save the database.
|
||||
// Save the database ?
|
||||
if($saveDatabase)
|
||||
{
|
||||
if( $this->save() === false ) {
|
||||
|
@ -421,7 +421,7 @@ class dbPosts extends dbJSON
|
|||
// All keys posts
|
||||
$allPosts[$key] = true;
|
||||
|
||||
// Create the new entry if not exists on DATABASE.
|
||||
// Create the new entry if not exist on DATABASE.
|
||||
if(!isset($this->db[$key])) {
|
||||
// New entry on database
|
||||
$this->db[$key] = $fields;
|
||||
|
@ -447,7 +447,7 @@ class dbPosts extends dbJSON
|
|||
if(Valid::date($valueFromFile, DB_DATE_FORMAT)) {
|
||||
$this->db[$key]['date'] = $valueFromFile;
|
||||
|
||||
if( $valueFromFile>$currentDate ) {
|
||||
if( $valueFromFile > $currentDate ) {
|
||||
$this->db[$key]['status'] = 'scheduled';
|
||||
}
|
||||
}
|
|
@ -152,12 +152,15 @@ class dbSite extends dbJSON
|
|||
return $this->getField('footer');
|
||||
}
|
||||
|
||||
// Returns the url site.
|
||||
// Returns the full domain and base url.
|
||||
// For example, http://www.domain.com/bludit/
|
||||
public function url()
|
||||
{
|
||||
return $this->getField('url');
|
||||
}
|
||||
|
||||
// Returns the protocol and the domain, without the base url.
|
||||
// For example, http://www.domain.com
|
||||
public function domain()
|
||||
{
|
||||
// If the URL field is not set, try detect the domain.
|
||||
|
@ -261,4 +264,4 @@ class dbSite extends dbJSON
|
|||
return date_default_timezone_set($timezone);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -26,4 +26,4 @@ class Email {
|
|||
return mail($args['to'], $args['subject'], $message, implode(PHP_EOL, $headers));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue