Merge remote-tracking branch 'upstream/master'
This commit is contained in:
commit
9f72d3d0cb
10
.gitignore
vendored
10
.gitignore
vendored
@ -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
|
||||
|
@ -6,7 +6,7 @@ AddDefaultCharset UTF-8
|
||||
RewriteEngine on
|
||||
|
||||
# Deny direct access to .txt files
|
||||
RewriteRule ^content/(.*)\.txt$ - [R=404,L]
|
||||
RewriteRule ^bl-content/(.*)\.txt$ - [R=404,L]
|
||||
|
||||
# All URL process by index.php
|
||||
RewriteCond %{REQUEST_FILENAME} !-f
|
||||
|
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**
|
||||
|
||||
[](https://gitter.im/dignajar/bludit?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
||||
|
||||
|
@ -1,13 +1,90 @@
|
||||
<?php defined('BLUDIT') or die('Bludit CMS.');
|
||||
|
||||
class Post extends fileContent
|
||||
{
|
||||
function __construct($key)
|
||||
{
|
||||
// Database Key
|
||||
$this->setField('key', $key);
|
||||
class Content {
|
||||
|
||||
public $vars;
|
||||
|
||||
function __construct($path)
|
||||
{
|
||||
if($this->build($path)===false) {
|
||||
$this->vars = false;
|
||||
}
|
||||
}
|
||||
|
||||
// Return true if valid
|
||||
public function isValid()
|
||||
{
|
||||
return($this->vars!==false);
|
||||
}
|
||||
|
||||
public function getField($field)
|
||||
{
|
||||
if(isset($this->vars[$field])) {
|
||||
return $this->vars[$field];
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// $notoverwrite true if you don't want to replace the value if are set previusly
|
||||
public function setField($field, $value, $overwrite=true)
|
||||
{
|
||||
if($overwrite || empty($this->vars[$field])) {
|
||||
$this->vars[$field] = $value;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private function build($path)
|
||||
{
|
||||
if( !Sanitize::pathFile($path, 'index.txt') ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$tmp = 0;
|
||||
$lines = file($path.'index.txt');
|
||||
foreach($lines as $lineNumber=>$line)
|
||||
{
|
||||
$parts = array_map('trim', explode(':', $line, 2));
|
||||
|
||||
// Lowercase variable
|
||||
$parts[0] = Text::lowercase($parts[0]);
|
||||
|
||||
// If variables is content then break the foreach and process the content after.
|
||||
if($parts[0]==='content')
|
||||
{
|
||||
$tmp = $lineNumber;
|
||||
break;
|
||||
}
|
||||
|
||||
if( !empty($parts[0]) && !empty($parts[1]) ) {
|
||||
// Sanitize all fields, except Content.
|
||||
$this->vars[$parts[0]] = Sanitize::html($parts[1]);
|
||||
}
|
||||
}
|
||||
|
||||
// Process the content.
|
||||
if($tmp!==0)
|
||||
{
|
||||
// Next line after "Content:" variable
|
||||
$tmp++;
|
||||
|
||||
// Remove lines after Content
|
||||
$output = array_slice($lines, $tmp);
|
||||
|
||||
if(!empty($parts[1])) {
|
||||
array_unshift($output, "\n");
|
||||
array_unshift($output, $parts[1]);
|
||||
}
|
||||
|
||||
$implode = implode($output);
|
||||
$this->vars['content'] = $implode;
|
||||
|
||||
// Sanitize content.
|
||||
//$this->vars['content'] = Sanitize::html($implode);
|
||||
}
|
||||
|
||||
parent::__construct(PATH_POSTS.$key.DS);
|
||||
}
|
||||
|
||||
// Returns the post title.
|
||||
@ -111,24 +188,11 @@ class Post extends fileContent
|
||||
return $User;
|
||||
}
|
||||
|
||||
// DEPRECATED
|
||||
public function username()
|
||||
{
|
||||
return $this->getField('username');
|
||||
}
|
||||
|
||||
// DEPRECATED
|
||||
public function authorFirstName()
|
||||
{
|
||||
return $this->getField('authorFirstName');
|
||||
}
|
||||
|
||||
// DEPRECATED
|
||||
public function authorLastName()
|
||||
{
|
||||
return $this->getField('authorLastName');
|
||||
}
|
||||
|
||||
public function description()
|
||||
{
|
||||
return $this->getField('description');
|
||||
@ -176,19 +240,16 @@ class Post extends fileContent
|
||||
}
|
||||
}
|
||||
|
||||
public function slug()
|
||||
{
|
||||
return $this->getField('key');
|
||||
}
|
||||
|
||||
public function permalink($absolute=false)
|
||||
{
|
||||
global $Url;
|
||||
global $Site;
|
||||
|
||||
$url = trim($Site->url(),'/');
|
||||
$filterType = $this->getField('filterType');
|
||||
|
||||
$url = trim(DOMAIN_BASE,'/');
|
||||
$key = $this->key();
|
||||
$filter = trim($Url->filters('post'), '/');
|
||||
$filter = trim($Url->filters($filterType), '/');
|
||||
$htmlPath = trim(HTML_PATH_ROOT,'/');
|
||||
|
||||
if(empty($filter)) {
|
||||
@ -209,4 +270,5 @@ class Post extends fileContent
|
||||
return '/'.$htmlPath.'/'.$tmp;
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -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);
|
||||
}
|
||||
|
||||
// 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);
|
||||
@ -68,19 +65,25 @@ class Plugin {
|
||||
return PATH_PLUGINS.$this->directoryName.DS;
|
||||
}
|
||||
|
||||
// Returns the item from plugin-data.
|
||||
public function getData($key)
|
||||
public function phpPathDB()
|
||||
{
|
||||
if(isset($this->data[$key])) {
|
||||
return $this->data[$key];
|
||||
return PATH_PLUGINS_DATABASES.$this->directoryName.DS;
|
||||
}
|
||||
|
||||
// Returns the item from plugin-data.
|
||||
public function getMetadata($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)
|
||||
@ -119,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()
|
||||
@ -181,7 +184,13 @@ class Plugin {
|
||||
|
||||
public function uninstall()
|
||||
{
|
||||
unlink($this->filenameDb);
|
||||
// Delete all files.
|
||||
$files = Filesystem::listFiles( $this->phpPathDB() );
|
||||
foreach($files as $file) {
|
||||
unlink($file);
|
||||
}
|
||||
|
||||
// Delete the directory.
|
||||
rmdir(PATH_PLUGINS_DATABASES.$this->directoryName);
|
||||
}
|
||||
|
@ -6,10 +6,35 @@
|
||||
function updateBludit()
|
||||
{
|
||||
global $Site;
|
||||
global $dbPosts;
|
||||
global $dbPages;
|
||||
|
||||
// Check if Bludit need to be update.
|
||||
if( ($Site->currentBuild() < BLUDIT_BUILD) || isset($_GET['update']) )
|
||||
{
|
||||
// --- Update dates on posts ---
|
||||
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 dates on pages ---
|
||||
foreach($dbPages->db as $key=>$page)
|
||||
{
|
||||
$date = Date::format($page['date'], 'Y-m-d H:i', DB_DATE_FORMAT);
|
||||
if($date !== false) {
|
||||
$dbPages->setPageDb($key,'date',$date);
|
||||
}
|
||||
}
|
||||
|
||||
$dbPages->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;
|
4
bl-kernel/admin/themes/default/css/font-awesome.min.css
vendored
Normal file
4
bl-kernel/admin/themes/default/css/font-awesome.min.css
vendored
Normal file
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,0 +1,9 @@
|
||||
.autocomplete-suggestions {
|
||||
text-align: left; cursor: default; border: 1px solid #ccc; border-top: 0; background: #fff; box-shadow: -1px 1px 3px rgba(0,0,0,.1);
|
||||
|
||||
/* core styles should not be changed */
|
||||
position: absolute; display: none; z-index: 9999; max-height: 254px; overflow: hidden; overflow-y: auto; box-sizing: border-box;
|
||||
}
|
||||
.autocomplete-suggestion { position: relative; padding: 0 .6em; line-height: 23px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 1.02em; color: #333; }
|
||||
.autocomplete-suggestion b { font-weight: normal; color: #1f8dd6; }
|
||||
.autocomplete-suggestion.selected { background: #f0f0f0; }
|
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,12 +20,14 @@
|
||||
|
||||
<link rel="stylesheet" type="text/css" href="./css/default.css?version=<?php echo BLUDIT_VERSION ?>">
|
||||
<link rel="stylesheet" type="text/css" href="./css/jquery.datetimepicker.css?version=<?php echo BLUDIT_VERSION ?>">
|
||||
<link rel="stylesheet" type="text/css" href="./css/jquery.auto-complete.css?version=<?php echo BLUDIT_VERSION ?>">
|
||||
|
||||
<!-- Javascript -->
|
||||
<script charset="utf-8" src="./js/jquery.min.js?version=<?php echo BLUDIT_VERSION ?>"></script>
|
||||
<script charset="utf-8" src="./js/uikit/uikit.min.js?version=<?php echo BLUDIT_VERSION ?>"></script>
|
||||
<script charset="utf-8" src="./js/uikit/upload.min.js?version=<?php echo BLUDIT_VERSION ?>"></script>
|
||||
<script charset="utf-8" src="./js/jquery.datetimepicker.js?version=<?php echo BLUDIT_VERSION ?>"></script>
|
||||
<script charset="utf-8" src="./js/jquery.auto-complete.min.js?version=<?php echo BLUDIT_VERSION ?>"></script>
|
||||
|
||||
<!-- Plugins -->
|
||||
<?php Theme::plugins('adminHead') ?>
|
@ -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,6 +67,110 @@ class HTML {
|
||||
echo $html;
|
||||
}
|
||||
|
||||
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>
|
||||
|
||||
'.$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;
|
||||
|
||||
}
|
||||
|
||||
public static function formInputPassword($args)
|
||||
{
|
||||
$args['type'] = 'password';
|
||||
@ -135,7 +254,7 @@ class HTML {
|
||||
$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);
|
||||
@ -150,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 .= '
|
||||
@ -323,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 .= '
|
3
bl-kernel/admin/themes/default/js/jquery.auto-complete.min.js
vendored
Normal file
3
bl-kernel/admin/themes/default/js/jquery.auto-complete.min.js
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
// jQuery autoComplete v1.0.7
|
||||
// https://github.com/Pixabay/jQuery-autoComplete
|
||||
!function(e){e.fn.autoComplete=function(t){var o=e.extend({},e.fn.autoComplete.defaults,t);return"string"==typeof t?(this.each(function(){var o=e(this);"destroy"==t&&(e(window).off("resize.autocomplete",o.updateSC),o.off("blur.autocomplete focus.autocomplete keydown.autocomplete keyup.autocomplete"),o.data("autocomplete")?o.attr("autocomplete",o.data("autocomplete")):o.removeAttr("autocomplete"),e(o.data("sc")).remove(),o.removeData("sc").removeData("autocomplete"))}),this):this.each(function(){function t(e){var t=s.val();if(s.cache[t]=e,e.length&&t.length>=o.minChars){for(var a="",c=0;c<e.length;c++)a+=o.renderItem(e[c],t);s.sc.html(a),s.updateSC(0)}else s.sc.hide()}var s=e(this);s.sc=e('<div class="autocomplete-suggestions '+o.menuClass+'"></div>'),s.data("sc",s.sc).data("autocomplete",s.attr("autocomplete")),s.attr("autocomplete","off"),s.cache={},s.last_val="",s.updateSC=function(t,o){if(s.sc.css({top:s.offset().top+s.outerHeight(),left:s.offset().left,width:s.outerWidth()}),!t&&(s.sc.show(),s.sc.maxHeight||(s.sc.maxHeight=parseInt(s.sc.css("max-height"))),s.sc.suggestionHeight||(s.sc.suggestionHeight=e(".autocomplete-suggestion",s.sc).first().outerHeight()),s.sc.suggestionHeight))if(o){var a=s.sc.scrollTop(),c=o.offset().top-s.sc.offset().top;c+s.sc.suggestionHeight-s.sc.maxHeight>0?s.sc.scrollTop(c+s.sc.suggestionHeight+a-s.sc.maxHeight):0>c&&s.sc.scrollTop(c+a)}else s.sc.scrollTop(0)},e(window).on("resize.autocomplete",s.updateSC),s.sc.appendTo("body"),s.sc.on("mouseleave",".autocomplete-suggestion",function(){e(".autocomplete-suggestion.selected").removeClass("selected")}),s.sc.on("mouseenter",".autocomplete-suggestion",function(){e(".autocomplete-suggestion.selected").removeClass("selected"),e(this).addClass("selected")}),s.sc.on("mousedown",".autocomplete-suggestion",function(t){var a=e(this),c=a.data("val");return(c||a.hasClass("autocomplete-suggestion"))&&(s.val(c),o.onSelect(t,c,a),s.sc.hide()),!1}),s.on("blur.autocomplete",function(){try{over_sb=e(".autocomplete-suggestions:hover").length}catch(t){over_sb=0}over_sb?s.is(":focus")||setTimeout(function(){s.focus()},20):(s.last_val=s.val(),s.sc.hide(),setTimeout(function(){s.sc.hide()},350))}),o.minChars||s.on("focus.autocomplete",function(){s.last_val="\n",s.trigger("keyup.autocomplete")}),s.on("keydown.autocomplete",function(t){if((40==t.which||38==t.which)&&s.sc.html()){var a,c=e(".autocomplete-suggestion.selected",s.sc);return c.length?(a=40==t.which?c.next(".autocomplete-suggestion"):c.prev(".autocomplete-suggestion"),a.length?(c.removeClass("selected"),s.val(a.addClass("selected").data("val"))):(c.removeClass("selected"),s.val(s.last_val),a=0)):(a=40==t.which?e(".autocomplete-suggestion",s.sc).first():e(".autocomplete-suggestion",s.sc).last(),s.val(a.addClass("selected").data("val"))),s.updateSC(0,a),!1}if(27==t.which)s.val(s.last_val).sc.hide();else if(13==t.which||9==t.which){var c=e(".autocomplete-suggestion.selected",s.sc);c.length&&s.sc.is(":visible")&&(o.onSelect(t,c.data("val"),c),setTimeout(function(){s.sc.hide()},20))}}),s.on("keyup.autocomplete",function(a){if(!~e.inArray(a.which,[13,27,35,36,37,38,39,40])){var c=s.val();if(c.length>=o.minChars){if(c!=s.last_val){if(s.last_val=c,clearTimeout(s.timer),o.cache){if(c in s.cache)return void t(s.cache[c]);for(var l=1;l<c.length-o.minChars;l++){var i=c.slice(0,c.length-l);if(i in s.cache&&!s.cache[i].length)return void t([])}}s.timer=setTimeout(function(){o.source(c,t)},o.delay)}}else s.last_val=c,s.sc.hide()}})})},e.fn.autoComplete.defaults={source:0,minChars:3,delay:150,cache:1,menuClass:"",renderItem:function(e,t){t=t.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&");var o=new RegExp("("+t.split(" ").join("|")+")","gi");return'<div class="autocomplete-suggestion" data-val="'+e+'">'+e.replace(o,"<b>$1</b>")+"</div>"},onSelect:function(e,t,o){}}}(jQuery);
|
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
@ -33,7 +33,7 @@ echo '<div class="uk-width-large-8-10">';
|
||||
'name'=>'content',
|
||||
'value'=>$_Page->contentRaw(false),
|
||||
'class'=>'uk-width-1-1 uk-form-large',
|
||||
'placeholder'=>$L->g('Content')
|
||||
'placeholder'=>''
|
||||
));
|
||||
|
||||
|
||||
@ -77,12 +77,13 @@ echo '<div class="sidebar uk-width-large-2-10">';
|
||||
));
|
||||
|
||||
// Tags input
|
||||
HTML::formInputText(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')
|
||||
'label'=>$L->g('Tags'),
|
||||
'words'=>'"'.implode('", "', $dbTags->getAll()).'"'
|
||||
));
|
||||
|
||||
echo '</li>';
|
@ -33,7 +33,7 @@ echo '<div class="uk-width-large-8-10">';
|
||||
'name'=>'content',
|
||||
'value'=>$_Post->contentRaw(false),
|
||||
'class'=>'uk-width-1-1 uk-form-large',
|
||||
'placeholder'=>$L->g('Content')
|
||||
'placeholder'=>''
|
||||
));
|
||||
|
||||
// Form buttons
|
||||
@ -71,12 +71,13 @@ echo '<div class="sidebar uk-width-large-2-10">';
|
||||
));
|
||||
|
||||
// Tags input
|
||||
HTML::formInputText(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')
|
||||
'label'=>$L->g('Tags'),
|
||||
'words'=>'"'.implode('", "', $dbTags->getAll()).'"'
|
||||
));
|
||||
|
||||
echo '</li>';
|
@ -27,7 +27,7 @@ echo '<div class="uk-width-large-8-10">';
|
||||
'name'=>'content',
|
||||
'value'=>'',
|
||||
'class'=>'uk-width-1-1 uk-form-large',
|
||||
'placeholder'=>$L->g('Content')
|
||||
'placeholder'=>''
|
||||
));
|
||||
|
||||
// Form buttons
|
||||
@ -64,12 +64,13 @@ echo '<div class="sidebar uk-width-large-2-10">';
|
||||
));
|
||||
|
||||
// Tags input
|
||||
HTML::formInputText(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')
|
||||
'label'=>$L->g('Tags'),
|
||||
'words'=>'"'.implode('", "', $dbTags->getAll()).'"'
|
||||
));
|
||||
|
||||
echo '</li>';
|
@ -27,7 +27,7 @@ echo '<div class="uk-width-large-8-10">';
|
||||
'name'=>'content',
|
||||
'value'=>'',
|
||||
'class'=>'uk-width-1-1 uk-form-large',
|
||||
'placeholder'=>$L->g('Content')
|
||||
'placeholder'=>''
|
||||
));
|
||||
|
||||
// Form buttons
|
||||
@ -64,12 +64,13 @@ echo '<div class="sidebar uk-width-large-2-10">';
|
||||
));
|
||||
|
||||
// Tags input
|
||||
HTML::formInputText(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')
|
||||
'label'=>$L->g('Tags'),
|
||||
'words'=>'"'.implode('", "', $dbTags->getAll()).'"'
|
||||
));
|
||||
|
||||
echo '</li>';
|
@ -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">
|
@ -4,7 +4,7 @@
|
||||
define('BLUDIT_VERSION', 'githubVersion');
|
||||
define('BLUDIT_CODENAME', '');
|
||||
define('BLUDIT_RELEASE_DATE', '');
|
||||
define('BLUDIT_BUILD', '20151119');
|
||||
define('BLUDIT_BUILD', '20160201');
|
||||
|
||||
// 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');
|
||||
@ -113,7 +117,7 @@ if(MB_STRING)
|
||||
|
||||
// Inclde Abstract Classes
|
||||
include(PATH_ABSTRACT.'dbjson.class.php');
|
||||
include(PATH_ABSTRACT.'filecontent.class.php');
|
||||
include(PATH_ABSTRACT.'content.class.php');
|
||||
include(PATH_ABSTRACT.'plugin.class.php');
|
||||
|
||||
// Inclde Classes
|
||||
@ -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 = '';
|
||||
@ -189,35 +195,45 @@ else {
|
||||
}
|
||||
|
||||
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_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);
|
||||
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);
|
||||
define('DOMAIN_THEME_JS', DOMAIN.HTML_PATH_THEME_JS);
|
||||
define('DOMAIN_THEME_IMG', DOMAIN.HTML_PATH_THEME_IMG);
|
||||
define('DOMAIN_UPLOADS', DOMAIN.HTML_PATH_UPLOADS);
|
||||
define('DOMAIN_UPLOADS_PROFILES', DOMAIN.HTML_PATH_UPLOADS_PROFILES);
|
||||
define('DOMAIN_UPLOADS_THUMBNAILS', DOMAIN.HTML_PATH_UPLOADS_THUMBNAILS);
|
||||
|
||||
// --- Objects with dependency ---
|
||||
$Language = new dbLanguage( $Site->locale() );
|
||||
$Login = new Login( $dbUsers );
|
@ -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();
|
@ -59,6 +59,11 @@ function buildPage($key)
|
||||
$content = Text::imgRel2Abs($content, HTML_PATH_UPLOADS); // Parse img src relative to absolute.
|
||||
$Page->setField('content', $content, true);
|
||||
|
||||
// Pagebrake
|
||||
$explode = explode(PAGE_BREAK, $content);
|
||||
$Page->setField('breakContent', $explode[0], true);
|
||||
$Page->setField('readMore', !empty($explode[1]), true);
|
||||
|
||||
// Date format
|
||||
$pageDate = $Page->date();
|
||||
$Page->setField('dateRaw', $pageDate, true);
|
@ -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
|
84
bl-kernel/boot/rules/99.themes.php
Normal file
84
bl-kernel/boot/rules/99.themes.php
Normal file
@ -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.'languages'.DS.$Site->locale().'.json';
|
||||
if( !Sanitize::pathFile($languageFilename) ) {
|
||||
$languageFilename = PATH_THEME.'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,6 +14,7 @@ class dbPages extends dbJSON
|
||||
'date'=> array('inFile'=>false, 'value'=>''),
|
||||
'position'=> array('inFile'=>false, 'value'=>0),
|
||||
'coverImage'=> array('inFile'=>false, 'value'=>''),
|
||||
'checksum'=> array('inFile'=>false, 'value'=>'')
|
||||
);
|
||||
|
||||
function __construct()
|
||||
@ -75,6 +76,10 @@ class dbPages extends dbJSON
|
||||
}
|
||||
}
|
||||
|
||||
// Create Hash
|
||||
$serialize = serialize($dataForDb+$dataForFile);
|
||||
$dataForDb['checksum'] = sha1($serialize);
|
||||
|
||||
// Make the directory. Recursive.
|
||||
if( Filesystem::mkdir(PATH_PAGES.$key, true) === false ) {
|
||||
Log::set(__METHOD__.LOG_SEP.'Error occurred when trying to create the directory '.PATH_PAGES.$key);
|
||||
@ -157,6 +162,10 @@ class dbPages extends dbJSON
|
||||
}
|
||||
}
|
||||
|
||||
// Create Hash
|
||||
$serialize = serialize($dataForDb+$dataForFile);
|
||||
$dataForDb['checksum'] = sha1($serialize);
|
||||
|
||||
// Move the directory from old key to new key.
|
||||
if($newKey!==$args['key'])
|
||||
{
|
||||
@ -224,6 +233,15 @@ class dbPages extends dbJSON
|
||||
return false;
|
||||
}
|
||||
|
||||
public function setPageDb($key, $field, $value)
|
||||
{
|
||||
if($this->pageExists($key)) {
|
||||
$this->db[$key][$field] = $value;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// Return TRUE if the page exists, FALSE otherwise.
|
||||
public function pageExists($key)
|
||||
{
|
@ -12,6 +12,7 @@ class dbPosts extends dbJSON
|
||||
'allowComments'=> array('inFile'=>false, 'value'=>false),
|
||||
'date'=> array('inFile'=>false, 'value'=>''),
|
||||
'coverImage'=> array('inFile'=>false, 'value'=>''),
|
||||
'checksum'=> array('inFile'=>false, 'value'=>'')
|
||||
);
|
||||
|
||||
private $numberPosts = array(
|
||||
@ -109,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';
|
||||
}
|
||||
@ -158,6 +159,10 @@ class dbPosts extends dbJSON
|
||||
}
|
||||
}
|
||||
|
||||
// Create Hash
|
||||
$serialize = serialize($dataForDb+$dataForFile);
|
||||
$dataForDb['checksum'] = sha1($serialize);
|
||||
|
||||
// Make the directory.
|
||||
if( Filesystem::mkdir(PATH_POSTS.$key) === false ) {
|
||||
Log::set(__METHOD__.LOG_SEP.'Error occurred when trying to create the directory '.PATH_POSTS.$key);
|
||||
@ -309,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')
|
||||
@ -325,7 +330,7 @@ class dbPosts extends dbJSON
|
||||
}
|
||||
}
|
||||
|
||||
// Save the database.
|
||||
// Save the database ?
|
||||
if($saveDatabase)
|
||||
{
|
||||
if( $this->save() === false ) {
|
||||
@ -416,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;
|
||||
@ -442,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';
|
||||
}
|
||||
}
|
@ -107,6 +107,18 @@ class dbSite extends dbJSON
|
||||
return $this->getField('title');
|
||||
}
|
||||
|
||||
// Returns the site slogan.
|
||||
public function slogan()
|
||||
{
|
||||
return $this->getField('slogan');
|
||||
}
|
||||
|
||||
// Returns the site description.
|
||||
public function description()
|
||||
{
|
||||
return $this->getField('description');
|
||||
}
|
||||
|
||||
public function emailFrom()
|
||||
{
|
||||
return $this->getField('emailFrom');
|
||||
@ -122,18 +134,6 @@ class dbSite extends dbJSON
|
||||
return $this->getField('timeFormat');
|
||||
}
|
||||
|
||||
// Returns the site slogan.
|
||||
public function slogan()
|
||||
{
|
||||
return $this->getField('slogan');
|
||||
}
|
||||
|
||||
// Returns the site description.
|
||||
public function description()
|
||||
{
|
||||
return $this->getField('description');
|
||||
}
|
||||
|
||||
// Returns the site theme name.
|
||||
public function theme()
|
||||
{
|
||||
@ -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.
|
||||
@ -170,16 +173,17 @@ class dbSite extends dbJSON
|
||||
$protocol = 'http://';
|
||||
}
|
||||
|
||||
$domain = $_SERVER['HTTP_HOST'];
|
||||
$domain = trim($_SERVER['HTTP_HOST'], '/');
|
||||
|
||||
return $protocol.$domain.HTML_PATH_ROOT;
|
||||
return $protocol.$domain;
|
||||
}
|
||||
|
||||
// Parse the domain from the field URL.
|
||||
$parse = parse_url($this->url());
|
||||
$domain = $parse['scheme']."://".$parse['host'];
|
||||
|
||||
return $domain;
|
||||
$domain = trim($parse['host'], '/');
|
||||
|
||||
return $parse['scheme'].'://'.$domain;
|
||||
}
|
||||
|
||||
// Returns TRUE if the cli mode is enabled, otherwise FALSE.
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user