commit
cf59449d23
|
@ -10,6 +10,6 @@ RewriteRule ^content/(.*)\.txt$ - [R=404,L]
|
|||
|
||||
# All URL process by index.php
|
||||
RewriteCond %{REQUEST_FILENAME} !-f
|
||||
RewriteRule ^(.*) index.php [L]
|
||||
RewriteRule ^(.*) index.php [PT,L]
|
||||
|
||||
</IfModule>
|
|
@ -13,7 +13,7 @@ Social
|
|||
------
|
||||
|
||||
- [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)
|
||||
|
||||
Requirements
|
||||
|
|
|
@ -20,11 +20,16 @@ function setSettings($args)
|
|||
|
||||
// Add slash at the begin and end.
|
||||
// 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['uriPost'] = Text::addSlashes($args['uriPost']);
|
||||
$args['uriPage'] = Text::addSlashes($args['uriPage']);
|
||||
$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) ) {
|
||||
|
|
|
@ -226,7 +226,7 @@ function install($adminPassword, $email)
|
|||
'error'=>array(
|
||||
'description'=>'Error page',
|
||||
'username'=>'admin',
|
||||
'tags'=>'',
|
||||
'tags'=>array(),
|
||||
'status'=>'published',
|
||||
'date'=>$currentDate,
|
||||
'position'=>0
|
||||
|
@ -241,7 +241,7 @@ function install($adminPassword, $email)
|
|||
'description'=>'Welcome to Bludit',
|
||||
'username'=>'admin',
|
||||
'status'=>'published',
|
||||
'tags'=>'bludit,cms,flat-file',
|
||||
'tags'=>array('bludit'=>'Bludit','cms'=>'CMS','flat-files'=>'Flat files'),
|
||||
'allowComments'=>false,
|
||||
'date'=>$currentDate
|
||||
)
|
||||
|
@ -305,7 +305,8 @@ function install($adminPassword, $email)
|
|||
array(
|
||||
'postsIndex'=>array(
|
||||
'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()
|
||||
),
|
||||
|
|
|
@ -134,7 +134,14 @@ $Parsedown = new Parsedown();
|
|||
$Security = new Security();
|
||||
|
||||
// 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);
|
||||
|
||||
// Paths for themes
|
||||
|
@ -151,6 +158,7 @@ define('HTML_PATH_PLUGINS', HTML_PATH_ROOT.'plugins/');
|
|||
|
||||
// PHP paths with dependency
|
||||
define('PATH_THEME', PATH_ROOT.'themes/'.$Site->theme().'/');
|
||||
define('PATH_THEME_PHP', PATH_THEME.'php'.DS);
|
||||
|
||||
// Objects with dependency
|
||||
$Language = new dbLanguage( $Site->locale() );
|
||||
|
|
|
@ -9,7 +9,7 @@ class dbPages extends dbJSON
|
|||
'content'=> array('inFile'=>true, 'value'=>''),
|
||||
'description'=> 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'),
|
||||
'date'=> array('inFile'=>false, 'value'=>0),
|
||||
'position'=> array('inFile'=>false, 'value'=>0)
|
||||
|
@ -43,12 +43,17 @@ class dbPages extends dbJSON
|
|||
{
|
||||
if( isset($args[$field]) )
|
||||
{
|
||||
// Sanitize if will be saved on database.
|
||||
if( !$options['inFile'] ) {
|
||||
$tmpValue = Sanitize::html($args[$field]);
|
||||
if($field=='tags') {
|
||||
$tmpValue = $this->generateTags($args['tags']);
|
||||
}
|
||||
else {
|
||||
$tmpValue = $args[$field];
|
||||
// Sanitize if will be saved on database.
|
||||
if( !$options['inFile'] ) {
|
||||
$tmpValue = Sanitize::html($args[$field]);
|
||||
}
|
||||
else {
|
||||
$tmpValue = $args[$field];
|
||||
}
|
||||
}
|
||||
}
|
||||
// Default value for the field.
|
||||
|
@ -120,12 +125,17 @@ class dbPages extends dbJSON
|
|||
{
|
||||
if( isset($args[$field]) )
|
||||
{
|
||||
// Sanitize if will be saved on database.
|
||||
if( !$options['inFile'] ) {
|
||||
$tmpValue = Sanitize::html($args[$field]);
|
||||
if($field=='tags') {
|
||||
$tmpValue = $this->generateTags($args['tags']);
|
||||
}
|
||||
else {
|
||||
$tmpValue = $args[$field];
|
||||
// Sanitize if will be saved on database.
|
||||
if( !$options['inFile'] ) {
|
||||
$tmpValue = Sanitize::html($args[$field]);
|
||||
}
|
||||
else {
|
||||
$tmpValue = $args[$field];
|
||||
}
|
||||
}
|
||||
}
|
||||
// Default value for the field.
|
||||
|
@ -285,6 +295,31 @@ class dbPages extends dbJSON
|
|||
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()
|
||||
{
|
||||
$db = $this->db;
|
||||
|
|
|
@ -8,7 +8,7 @@ class dbPosts extends dbJSON
|
|||
'description'=> array('inFile'=>false, 'value'=>''),
|
||||
'username'=> array('inFile'=>false, 'value'=>''),
|
||||
'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),
|
||||
'date'=> array('inFile'=>false, 'value'=>'')
|
||||
);
|
||||
|
@ -112,26 +112,26 @@ class dbPosts extends dbJSON
|
|||
$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.
|
||||
foreach($this->dbFields as $field=>$options)
|
||||
{
|
||||
// If the field is in the arguments.
|
||||
if( isset($args[$field]) )
|
||||
{
|
||||
// Sanitize if will be saved on database.
|
||||
if( !$options['inFile'] ) {
|
||||
$tmpValue = Sanitize::html($args[$field]);
|
||||
if($field=='tags') {
|
||||
$tmpValue = $this->generateTags($args['tags']);
|
||||
}
|
||||
else {
|
||||
$tmpValue = $args[$field];
|
||||
// Sanitize if will be saved on database.
|
||||
if( !$options['inFile'] ) {
|
||||
$tmpValue = Sanitize::html($args[$field]);
|
||||
}
|
||||
else {
|
||||
$tmpValue = $args[$field];
|
||||
}
|
||||
}
|
||||
}
|
||||
// Default value for the field.
|
||||
// Default value if not in the arguments.
|
||||
else
|
||||
{
|
||||
$tmpValue = $options['value'];
|
||||
|
@ -332,6 +332,31 @@ class dbPosts extends dbJSON
|
|||
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.
|
||||
public function sortByDate($HighToLow=true)
|
||||
{
|
||||
|
|
|
@ -64,8 +64,9 @@ class dbSite extends dbJSON
|
|||
$filters['page'] = $this->db['uriPage'];
|
||||
$filters['tag'] = $this->db['uriTag'];
|
||||
|
||||
if(empty($filter))
|
||||
if(empty($filter)) {
|
||||
return $filters;
|
||||
}
|
||||
|
||||
return $filters[$filter];
|
||||
}
|
||||
|
@ -97,15 +98,6 @@ class dbSite extends dbJSON
|
|||
return $this->db['slogan'];
|
||||
}
|
||||
|
||||
public function advancedOptions()
|
||||
{
|
||||
if($this->db['advancedOptions']==='true') {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// Returns the site description.
|
||||
public function description()
|
||||
{
|
||||
|
|
|
@ -59,25 +59,17 @@ class dbTags extends dbJSON
|
|||
// Foreach post
|
||||
foreach($db as $postKey=>$values)
|
||||
{
|
||||
$explode = explode(',', $values['tags']);
|
||||
$tags = $values['tags'];
|
||||
|
||||
// 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]) ) {
|
||||
array_push($tagsIndex[$tagKey]['posts'], $postKey);
|
||||
}
|
||||
else {
|
||||
$tagsIndex[$tagKey]['name'] = $tagName;
|
||||
$tagsIndex[$tagKey]['posts'] = array($postKey);
|
||||
}
|
||||
if( isset($tagsIndex[$tagKey]) ) {
|
||||
array_push($tagsIndex[$tagKey]['posts'], $postKey);
|
||||
}
|
||||
else {
|
||||
$tagsIndex[$tagKey]['name'] = $tagName;
|
||||
$tagsIndex[$tagKey]['posts'] = array($postKey);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -49,15 +49,24 @@ class Page extends fileContent
|
|||
return $this->getField('description');
|
||||
}
|
||||
|
||||
public function tags()
|
||||
public function tags($returnsArray=false)
|
||||
{
|
||||
return $this->getField('tags');
|
||||
}
|
||||
global $Url;
|
||||
|
||||
public function tagsArray()
|
||||
{
|
||||
$tags = $this->getField('tags');
|
||||
return explode(',', $tags);
|
||||
|
||||
if($returnsArray) {
|
||||
|
||||
if($tags==false) {
|
||||
return array();
|
||||
}
|
||||
|
||||
return $tags;
|
||||
}
|
||||
else {
|
||||
// Return string with tags separeted by comma.
|
||||
return implode(', ', $tags);
|
||||
}
|
||||
}
|
||||
|
||||
public function position()
|
||||
|
|
|
@ -123,10 +123,11 @@ class Post extends fileContent
|
|||
return array();
|
||||
}
|
||||
|
||||
return explode(',', $tags);
|
||||
return $tags;
|
||||
}
|
||||
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":
|
||||
{
|
||||
"name": "SimpleMDE",
|
||||
"description": "A simple, beautiful, and embeddable JavaScript markdown editor by @WesCossick.",
|
||||
"author": "Bludit",
|
||||
"description": "A simple, beautiful, and embeddable JavaScript markdown editor by @WesCossick. Adapted by Diego Najar for Bludit.",
|
||||
"author": "NextStepWebs",
|
||||
"email": "",
|
||||
"website": "https://github.com/NextStepWebs/simplemde-markdown-editor",
|
||||
"version": "0.1",
|
||||
"releaseDate": "2015-08-27"
|
||||
"version": "1.7.1",
|
||||
"releaseDate": "2015-09-18"
|
||||
},
|
||||
"toolbar": "Toolbar",
|
||||
"tab-size": "Tab size"
|
||||
|
|
|
@ -2,12 +2,12 @@
|
|||
"plugin-data":
|
||||
{
|
||||
"name": "SimpleMDE",
|
||||
"description": "Simple, facil y hermoso editor Markdown desarrollado por @WesCossick.",
|
||||
"author": "Bludit",
|
||||
"description": "Simple, facil y hermoso editor Markdown desarrollado por @WesCossick. Adaptado por Diego Najar para Bludit.",
|
||||
"author": "NextStepWebs",
|
||||
"email": "",
|
||||
"website": "https://github.com/NextStepWebs/simplemde-markdown-editor",
|
||||
"version": "0.1",
|
||||
"releaseDate": "2015-08-27"
|
||||
"version": "1.7.1",
|
||||
"releaseDate": "2015-09-18"
|
||||
},
|
||||
"toolbar": "Barra de herramientas",
|
||||
"tab-size": "Tamaño de la tabulación"
|
||||
|
|
|
@ -3,10 +3,12 @@
|
|||
{
|
||||
"name": "SimpleMDE",
|
||||
"description": "Un éditeur Markdown en JavaScript simple, beau, et intégrable.",
|
||||
"author": "Bludit",
|
||||
"author": "NextStepWebs",
|
||||
"email": "",
|
||||
"website": "https://github.com/NextStepWebs/simplemde-markdown-editor",
|
||||
"version": "0.1",
|
||||
"releaseDate": "2015-08-27"
|
||||
}
|
||||
"version": "1.7.1",
|
||||
"releaseDate": "2015-09-18"
|
||||
},
|
||||
"toolbar": "Toolbar",
|
||||
"tab-size": "Tab size"
|
||||
}
|
Loading…
Reference in New Issue