commit
cf59449d23
|
@ -10,6 +10,6 @@ RewriteRule ^content/(.*)\.txt$ - [R=404,L]
|
||||||
|
|
||||||
# All URL process by index.php
|
# All URL process by index.php
|
||||||
RewriteCond %{REQUEST_FILENAME} !-f
|
RewriteCond %{REQUEST_FILENAME} !-f
|
||||||
RewriteRule ^(.*) index.php [L]
|
RewriteRule ^(.*) index.php [PT,L]
|
||||||
|
|
||||||
</IfModule>
|
</IfModule>
|
|
@ -13,7 +13,7 @@ Social
|
||||||
------
|
------
|
||||||
|
|
||||||
- [Twitter](https://twitter.com/bludit)
|
- [Twitter](https://twitter.com/bludit)
|
||||||
- [Facebook](https://www.facebook.com/pages/Bludit/239255789455913)
|
- [Facebook](https://www.facebook.com/bluditcms)
|
||||||
- [Google+](https://plus.google.com/+Bluditcms)
|
- [Google+](https://plus.google.com/+Bluditcms)
|
||||||
|
|
||||||
Requirements
|
Requirements
|
||||||
|
|
|
@ -20,11 +20,16 @@ function setSettings($args)
|
||||||
|
|
||||||
// Add slash at the begin and end.
|
// Add slash at the begin and end.
|
||||||
// This fields are in the settings->advanced mode
|
// This fields are in the settings->advanced mode
|
||||||
if(isset($args['advanced'])) {
|
if(isset($args['form-advanced'])) {
|
||||||
$args['url'] = Text::addSlashes($args['url'],false,true);
|
$args['url'] = Text::addSlashes($args['url'],false,true);
|
||||||
$args['uriPost'] = Text::addSlashes($args['uriPost']);
|
$args['uriPost'] = Text::addSlashes($args['uriPost']);
|
||||||
$args['uriPage'] = Text::addSlashes($args['uriPage']);
|
$args['uriPage'] = Text::addSlashes($args['uriPage']);
|
||||||
$args['uriTag'] = Text::addSlashes($args['uriTag']);
|
$args['uriTag'] = Text::addSlashes($args['uriTag']);
|
||||||
|
|
||||||
|
if(($args['uriPost']==$args['uriPage']) || ($args['uriPost']==$args['uriTag']) || ($args['uriPage']==$args['uriTag']) )
|
||||||
|
{
|
||||||
|
$args = array();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if( $Site->set($args) ) {
|
if( $Site->set($args) ) {
|
||||||
|
|
|
@ -226,7 +226,7 @@ function install($adminPassword, $email)
|
||||||
'error'=>array(
|
'error'=>array(
|
||||||
'description'=>'Error page',
|
'description'=>'Error page',
|
||||||
'username'=>'admin',
|
'username'=>'admin',
|
||||||
'tags'=>'',
|
'tags'=>array(),
|
||||||
'status'=>'published',
|
'status'=>'published',
|
||||||
'date'=>$currentDate,
|
'date'=>$currentDate,
|
||||||
'position'=>0
|
'position'=>0
|
||||||
|
@ -241,7 +241,7 @@ function install($adminPassword, $email)
|
||||||
'description'=>'Welcome to Bludit',
|
'description'=>'Welcome to Bludit',
|
||||||
'username'=>'admin',
|
'username'=>'admin',
|
||||||
'status'=>'published',
|
'status'=>'published',
|
||||||
'tags'=>'bludit,cms,flat-file',
|
'tags'=>array('bludit'=>'Bludit','cms'=>'CMS','flat-files'=>'Flat files'),
|
||||||
'allowComments'=>false,
|
'allowComments'=>false,
|
||||||
'date'=>$currentDate
|
'date'=>$currentDate
|
||||||
)
|
)
|
||||||
|
@ -305,7 +305,8 @@ function install($adminPassword, $email)
|
||||||
array(
|
array(
|
||||||
'postsIndex'=>array(
|
'postsIndex'=>array(
|
||||||
'bludit'=>array('name'=>'Bludit', 'posts'=>array('first-post')),
|
'bludit'=>array('name'=>'Bludit', 'posts'=>array('first-post')),
|
||||||
'cms'=>array('name'=>'cms', 'posts'=>array('first-post'))
|
'cms'=>array('name'=>'CMS', 'posts'=>array('first-post')),
|
||||||
|
'flat-files'=>array('name'=>'Flat files', 'posts'=>array('first-post'))
|
||||||
),
|
),
|
||||||
'pagesIndex'=>array()
|
'pagesIndex'=>array()
|
||||||
),
|
),
|
||||||
|
|
|
@ -134,7 +134,14 @@ $Parsedown = new Parsedown();
|
||||||
$Security = new Security();
|
$Security = new Security();
|
||||||
|
|
||||||
// HTML PATHs
|
// HTML PATHs
|
||||||
$base = (dirname(getenv('SCRIPT_NAME'))==DS)?'/':dirname(getenv('SCRIPT_NAME')).'/';
|
//$base = (dirname(getenv('SCRIPT_NAME'))==DS)?'/':dirname(getenv('SCRIPT_NAME')).'/';
|
||||||
|
$base = empty( $_SERVER['SCRIPT_NAME'] ) ? $_SERVER['PHP_SELF'] : $_SERVER['SCRIPT_NAME'];
|
||||||
|
$base = dirname($base);
|
||||||
|
|
||||||
|
if($base!=DS) {
|
||||||
|
$base = $base.'/';
|
||||||
|
}
|
||||||
|
|
||||||
define('HTML_PATH_ROOT', $base);
|
define('HTML_PATH_ROOT', $base);
|
||||||
|
|
||||||
// Paths for themes
|
// Paths for themes
|
||||||
|
@ -151,6 +158,7 @@ define('HTML_PATH_PLUGINS', HTML_PATH_ROOT.'plugins/');
|
||||||
|
|
||||||
// PHP paths with dependency
|
// PHP paths with dependency
|
||||||
define('PATH_THEME', PATH_ROOT.'themes/'.$Site->theme().'/');
|
define('PATH_THEME', PATH_ROOT.'themes/'.$Site->theme().'/');
|
||||||
|
define('PATH_THEME_PHP', PATH_THEME.'php'.DS);
|
||||||
|
|
||||||
// Objects with dependency
|
// Objects with dependency
|
||||||
$Language = new dbLanguage( $Site->locale() );
|
$Language = new dbLanguage( $Site->locale() );
|
||||||
|
|
|
@ -9,7 +9,7 @@ class dbPages extends dbJSON
|
||||||
'content'=> array('inFile'=>true, 'value'=>''),
|
'content'=> array('inFile'=>true, 'value'=>''),
|
||||||
'description'=> array('inFile'=>false, 'value'=>''),
|
'description'=> array('inFile'=>false, 'value'=>''),
|
||||||
'username'=> array('inFile'=>false, 'value'=>''),
|
'username'=> array('inFile'=>false, 'value'=>''),
|
||||||
'tags'=> array('inFile'=>false, 'value'=>''),
|
'tags'=> array('inFile'=>false, 'value'=>array()),
|
||||||
'status'=> array('inFile'=>false, 'value'=>'draft'),
|
'status'=> array('inFile'=>false, 'value'=>'draft'),
|
||||||
'date'=> array('inFile'=>false, 'value'=>0),
|
'date'=> array('inFile'=>false, 'value'=>0),
|
||||||
'position'=> array('inFile'=>false, 'value'=>0)
|
'position'=> array('inFile'=>false, 'value'=>0)
|
||||||
|
@ -43,6 +43,10 @@ class dbPages extends dbJSON
|
||||||
{
|
{
|
||||||
if( isset($args[$field]) )
|
if( isset($args[$field]) )
|
||||||
{
|
{
|
||||||
|
if($field=='tags') {
|
||||||
|
$tmpValue = $this->generateTags($args['tags']);
|
||||||
|
}
|
||||||
|
else {
|
||||||
// Sanitize if will be saved on database.
|
// Sanitize if will be saved on database.
|
||||||
if( !$options['inFile'] ) {
|
if( !$options['inFile'] ) {
|
||||||
$tmpValue = Sanitize::html($args[$field]);
|
$tmpValue = Sanitize::html($args[$field]);
|
||||||
|
@ -51,6 +55,7 @@ class dbPages extends dbJSON
|
||||||
$tmpValue = $args[$field];
|
$tmpValue = $args[$field];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
// Default value for the field.
|
// Default value for the field.
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -120,6 +125,10 @@ class dbPages extends dbJSON
|
||||||
{
|
{
|
||||||
if( isset($args[$field]) )
|
if( isset($args[$field]) )
|
||||||
{
|
{
|
||||||
|
if($field=='tags') {
|
||||||
|
$tmpValue = $this->generateTags($args['tags']);
|
||||||
|
}
|
||||||
|
else {
|
||||||
// Sanitize if will be saved on database.
|
// Sanitize if will be saved on database.
|
||||||
if( !$options['inFile'] ) {
|
if( !$options['inFile'] ) {
|
||||||
$tmpValue = Sanitize::html($args[$field]);
|
$tmpValue = Sanitize::html($args[$field]);
|
||||||
|
@ -128,6 +137,7 @@ class dbPages extends dbJSON
|
||||||
$tmpValue = $args[$field];
|
$tmpValue = $args[$field];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
// Default value for the field.
|
// Default value for the field.
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -285,6 +295,31 @@ class dbPages extends dbJSON
|
||||||
return $this->db;
|
return $this->db;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Returns an Array, array('tagSlug'=>'tagName')
|
||||||
|
// (string) $tags, tag list separeted by comma.
|
||||||
|
public function generateTags($tags)
|
||||||
|
{
|
||||||
|
$tmp = array();
|
||||||
|
|
||||||
|
$tags = trim($tags);
|
||||||
|
|
||||||
|
if(empty($tags)) {
|
||||||
|
return $tmp;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Make array
|
||||||
|
$tags = explode(',', $tags);
|
||||||
|
|
||||||
|
foreach($tags as $tag)
|
||||||
|
{
|
||||||
|
$tag = trim($tag);
|
||||||
|
$tagKey = Text::cleanUrl($tag);
|
||||||
|
$tmp[$tagKey] = $tag;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $tmp;
|
||||||
|
}
|
||||||
|
|
||||||
public function regenerateCli()
|
public function regenerateCli()
|
||||||
{
|
{
|
||||||
$db = $this->db;
|
$db = $this->db;
|
||||||
|
|
|
@ -8,7 +8,7 @@ class dbPosts extends dbJSON
|
||||||
'description'=> array('inFile'=>false, 'value'=>''),
|
'description'=> array('inFile'=>false, 'value'=>''),
|
||||||
'username'=> array('inFile'=>false, 'value'=>''),
|
'username'=> array('inFile'=>false, 'value'=>''),
|
||||||
'status'=> array('inFile'=>false, 'value'=>'draft'), // published, draft, scheduled
|
'status'=> array('inFile'=>false, 'value'=>'draft'), // published, draft, scheduled
|
||||||
'tags'=> array('inFile'=>false, 'value'=>''),
|
'tags'=> array('inFile'=>false, 'value'=>array()),
|
||||||
'allowComments'=> array('inFile'=>false, 'value'=>false),
|
'allowComments'=> array('inFile'=>false, 'value'=>false),
|
||||||
'date'=> array('inFile'=>false, 'value'=>'')
|
'date'=> array('inFile'=>false, 'value'=>'')
|
||||||
);
|
);
|
||||||
|
@ -112,17 +112,16 @@ class dbPosts extends dbJSON
|
||||||
$args['status'] = 'scheduled';
|
$args['status'] = 'scheduled';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Tags
|
|
||||||
if(Text::isNotEmpty($args['tags'])) {
|
|
||||||
$cleanTags = array_map('trim', explode(',', $args['tags']));
|
|
||||||
$args['tags'] = implode(',', $cleanTags);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Verify arguments with the database fields.
|
// Verify arguments with the database fields.
|
||||||
foreach($this->dbFields as $field=>$options)
|
foreach($this->dbFields as $field=>$options)
|
||||||
{
|
{
|
||||||
|
// If the field is in the arguments.
|
||||||
if( isset($args[$field]) )
|
if( isset($args[$field]) )
|
||||||
{
|
{
|
||||||
|
if($field=='tags') {
|
||||||
|
$tmpValue = $this->generateTags($args['tags']);
|
||||||
|
}
|
||||||
|
else {
|
||||||
// Sanitize if will be saved on database.
|
// Sanitize if will be saved on database.
|
||||||
if( !$options['inFile'] ) {
|
if( !$options['inFile'] ) {
|
||||||
$tmpValue = Sanitize::html($args[$field]);
|
$tmpValue = Sanitize::html($args[$field]);
|
||||||
|
@ -131,7 +130,8 @@ class dbPosts extends dbJSON
|
||||||
$tmpValue = $args[$field];
|
$tmpValue = $args[$field];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Default value for the field.
|
}
|
||||||
|
// Default value if not in the arguments.
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$tmpValue = $options['value'];
|
$tmpValue = $options['value'];
|
||||||
|
@ -332,6 +332,31 @@ class dbPosts extends dbJSON
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Returns an Array, array('tagSlug'=>'tagName')
|
||||||
|
// (string) $tags, tag list separeted by comma.
|
||||||
|
public function generateTags($tags)
|
||||||
|
{
|
||||||
|
$tmp = array();
|
||||||
|
|
||||||
|
$tags = trim($tags);
|
||||||
|
|
||||||
|
if(empty($tags)) {
|
||||||
|
return $tmp;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Make array
|
||||||
|
$tags = explode(',', $tags);
|
||||||
|
|
||||||
|
foreach($tags as $tag)
|
||||||
|
{
|
||||||
|
$tag = trim($tag);
|
||||||
|
$tagKey = Text::cleanUrl($tag);
|
||||||
|
$tmp[$tagKey] = $tag;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $tmp;
|
||||||
|
}
|
||||||
|
|
||||||
// Sort posts by date.
|
// Sort posts by date.
|
||||||
public function sortByDate($HighToLow=true)
|
public function sortByDate($HighToLow=true)
|
||||||
{
|
{
|
||||||
|
|
|
@ -64,8 +64,9 @@ class dbSite extends dbJSON
|
||||||
$filters['page'] = $this->db['uriPage'];
|
$filters['page'] = $this->db['uriPage'];
|
||||||
$filters['tag'] = $this->db['uriTag'];
|
$filters['tag'] = $this->db['uriTag'];
|
||||||
|
|
||||||
if(empty($filter))
|
if(empty($filter)) {
|
||||||
return $filters;
|
return $filters;
|
||||||
|
}
|
||||||
|
|
||||||
return $filters[$filter];
|
return $filters[$filter];
|
||||||
}
|
}
|
||||||
|
@ -97,15 +98,6 @@ class dbSite extends dbJSON
|
||||||
return $this->db['slogan'];
|
return $this->db['slogan'];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function advancedOptions()
|
|
||||||
{
|
|
||||||
if($this->db['advancedOptions']==='true') {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Returns the site description.
|
// Returns the site description.
|
||||||
public function description()
|
public function description()
|
||||||
{
|
{
|
||||||
|
|
|
@ -59,17 +59,10 @@ class dbTags extends dbJSON
|
||||||
// Foreach post
|
// Foreach post
|
||||||
foreach($db as $postKey=>$values)
|
foreach($db as $postKey=>$values)
|
||||||
{
|
{
|
||||||
$explode = explode(',', $values['tags']);
|
$tags = $values['tags'];
|
||||||
|
|
||||||
// Foreach tag from post
|
// Foreach tag from post
|
||||||
foreach($explode as $tagName)
|
foreach($tags as $tagKey=>$tagName)
|
||||||
{
|
|
||||||
$tagName = trim($tagName);
|
|
||||||
$tagKey = $tagName;
|
|
||||||
//$tagKey = Text::cleanUrl($tagName);
|
|
||||||
|
|
||||||
// If the tag is not empty.
|
|
||||||
if(Text::isNotEmpty($tagName))
|
|
||||||
{
|
{
|
||||||
if( isset($tagsIndex[$tagKey]) ) {
|
if( isset($tagsIndex[$tagKey]) ) {
|
||||||
array_push($tagsIndex[$tagKey]['posts'], $postKey);
|
array_push($tagsIndex[$tagKey]['posts'], $postKey);
|
||||||
|
@ -80,7 +73,6 @@ class dbTags extends dbJSON
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
$this->db['postsIndex'] = $tagsIndex;
|
$this->db['postsIndex'] = $tagsIndex;
|
||||||
|
|
||||||
|
|
|
@ -49,15 +49,24 @@ class Page extends fileContent
|
||||||
return $this->getField('description');
|
return $this->getField('description');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function tags()
|
public function tags($returnsArray=false)
|
||||||
{
|
{
|
||||||
return $this->getField('tags');
|
global $Url;
|
||||||
|
|
||||||
|
$tags = $this->getField('tags');
|
||||||
|
|
||||||
|
if($returnsArray) {
|
||||||
|
|
||||||
|
if($tags==false) {
|
||||||
|
return array();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function tagsArray()
|
return $tags;
|
||||||
{
|
}
|
||||||
$tags = $this->getField('tags');
|
else {
|
||||||
return explode(',', $tags);
|
// Return string with tags separeted by comma.
|
||||||
|
return implode(', ', $tags);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function position()
|
public function position()
|
||||||
|
|
|
@ -123,10 +123,11 @@ class Post extends fileContent
|
||||||
return array();
|
return array();
|
||||||
}
|
}
|
||||||
|
|
||||||
return explode(',', $tags);
|
return $tags;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return $tags;
|
// Return string with tags separeted by comma.
|
||||||
|
return implode(', ', $tags);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -2,12 +2,12 @@
|
||||||
"plugin-data":
|
"plugin-data":
|
||||||
{
|
{
|
||||||
"name": "SimpleMDE",
|
"name": "SimpleMDE",
|
||||||
"description": "A simple, beautiful, and embeddable JavaScript markdown editor by @WesCossick.",
|
"description": "A simple, beautiful, and embeddable JavaScript markdown editor by @WesCossick. Adapted by Diego Najar for Bludit.",
|
||||||
"author": "Bludit",
|
"author": "NextStepWebs",
|
||||||
"email": "",
|
"email": "",
|
||||||
"website": "https://github.com/NextStepWebs/simplemde-markdown-editor",
|
"website": "https://github.com/NextStepWebs/simplemde-markdown-editor",
|
||||||
"version": "0.1",
|
"version": "1.7.1",
|
||||||
"releaseDate": "2015-08-27"
|
"releaseDate": "2015-09-18"
|
||||||
},
|
},
|
||||||
"toolbar": "Toolbar",
|
"toolbar": "Toolbar",
|
||||||
"tab-size": "Tab size"
|
"tab-size": "Tab size"
|
||||||
|
|
|
@ -2,12 +2,12 @@
|
||||||
"plugin-data":
|
"plugin-data":
|
||||||
{
|
{
|
||||||
"name": "SimpleMDE",
|
"name": "SimpleMDE",
|
||||||
"description": "Simple, facil y hermoso editor Markdown desarrollado por @WesCossick.",
|
"description": "Simple, facil y hermoso editor Markdown desarrollado por @WesCossick. Adaptado por Diego Najar para Bludit.",
|
||||||
"author": "Bludit",
|
"author": "NextStepWebs",
|
||||||
"email": "",
|
"email": "",
|
||||||
"website": "https://github.com/NextStepWebs/simplemde-markdown-editor",
|
"website": "https://github.com/NextStepWebs/simplemde-markdown-editor",
|
||||||
"version": "0.1",
|
"version": "1.7.1",
|
||||||
"releaseDate": "2015-08-27"
|
"releaseDate": "2015-09-18"
|
||||||
},
|
},
|
||||||
"toolbar": "Barra de herramientas",
|
"toolbar": "Barra de herramientas",
|
||||||
"tab-size": "Tamaño de la tabulación"
|
"tab-size": "Tamaño de la tabulación"
|
||||||
|
|
|
@ -3,10 +3,12 @@
|
||||||
{
|
{
|
||||||
"name": "SimpleMDE",
|
"name": "SimpleMDE",
|
||||||
"description": "Un éditeur Markdown en JavaScript simple, beau, et intégrable.",
|
"description": "Un éditeur Markdown en JavaScript simple, beau, et intégrable.",
|
||||||
"author": "Bludit",
|
"author": "NextStepWebs",
|
||||||
"email": "",
|
"email": "",
|
||||||
"website": "https://github.com/NextStepWebs/simplemde-markdown-editor",
|
"website": "https://github.com/NextStepWebs/simplemde-markdown-editor",
|
||||||
"version": "0.1",
|
"version": "1.7.1",
|
||||||
"releaseDate": "2015-08-27"
|
"releaseDate": "2015-09-18"
|
||||||
}
|
},
|
||||||
|
"toolbar": "Toolbar",
|
||||||
|
"tab-size": "Tab size"
|
||||||
}
|
}
|
Loading…
Reference in New Issue