Merge pull request #1 from dignajar/master

Sync Fork
This commit is contained in:
clickwork-git 2015-09-18 22:59:15 +02:00
commit cf59449d23
41 changed files with 154 additions and 84 deletions

View File

@ -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>

View File

@ -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

View File

@ -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) ) {

0
admin/views/manage-posts.php Executable file → Normal file
View File

7
install.php Executable file → Normal file
View File

@ -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()
),

View File

@ -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() );

View File

@ -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,6 +43,10 @@ class dbPages extends dbJSON
{
if( isset($args[$field]) )
{
if($field=='tags') {
$tmpValue = $this->generateTags($args['tags']);
}
else {
// Sanitize if will be saved on database.
if( !$options['inFile'] ) {
$tmpValue = Sanitize::html($args[$field]);
@ -51,6 +55,7 @@ class dbPages extends dbJSON
$tmpValue = $args[$field];
}
}
}
// Default value for the field.
else
{
@ -120,6 +125,10 @@ class dbPages extends dbJSON
{
if( isset($args[$field]) )
{
if($field=='tags') {
$tmpValue = $this->generateTags($args['tags']);
}
else {
// Sanitize if will be saved on database.
if( !$options['inFile'] ) {
$tmpValue = Sanitize::html($args[$field]);
@ -128,6 +137,7 @@ class dbPages extends dbJSON
$tmpValue = $args[$field];
}
}
}
// Default value for the field.
else
{
@ -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;

View File

@ -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,17 +112,16 @@ 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]) )
{
if($field=='tags') {
$tmpValue = $this->generateTags($args['tags']);
}
else {
// Sanitize if will be saved on database.
if( !$options['inFile'] ) {
$tmpValue = Sanitize::html($args[$field]);
@ -131,7 +130,8 @@ class dbPosts extends dbJSON
$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)
{

View File

@ -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()
{

View File

@ -59,17 +59,10 @@ 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)
{
$tagName = trim($tagName);
$tagKey = $tagName;
//$tagKey = Text::cleanUrl($tagName);
// If the tag is not empty.
if(Text::isNotEmpty($tagName))
foreach($tags as $tagKey=>$tagName)
{
if( isset($tagsIndex[$tagKey]) ) {
array_push($tagsIndex[$tagKey]['posts'], $postKey);
@ -80,7 +73,6 @@ class dbTags extends dbJSON
}
}
}
}
$this->db['postsIndex'] = $tagsIndex;

View File

@ -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;
$tags = $this->getField('tags');
if($returnsArray) {
if($tags==false) {
return array();
}
public function tagsArray()
{
$tags = $this->getField('tags');
return explode(',', $tags);
return $tags;
}
else {
// Return string with tags separeted by comma.
return implode(', ', $tags);
}
}
public function position()

View File

@ -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);
}
}

0
languages/cs_CZ.json Executable file → Normal file
View File

0
languages/de_DE.json Executable file → Normal file
View File

0
languages/en_US.json Executable file → Normal file
View File

0
languages/es_AR.json Executable file → Normal file
View File

0
languages/es_ES.json Executable file → Normal file
View File

0
languages/es_VE.json Executable file → Normal file
View File

0
languages/fr_FR.json Executable file → Normal file
View File

0
languages/ja_JP.json Executable file → Normal file
View File

0
languages/ru_RU.json Executable file → Normal file
View File

0
languages/zh_TW.json Executable file → Normal file
View File

0
plugins/maintancemode/languages/en_US.json Executable file → Normal file
View File

0
plugins/maintancemode/languages/es_AR.json Executable file → Normal file
View File

0
plugins/maintancemode/languages/fr_FR.json Executable file → Normal file
View File

0
plugins/maintancemode/plugin.php Executable file → Normal file
View File

0
plugins/pages/languages/en_US.json Executable file → Normal file
View File

0
plugins/pages/languages/es_AR.json Executable file → Normal file
View File

0
plugins/pages/languages/fr_FR.json Executable file → Normal file
View File

0
plugins/pages/plugin.php Executable file → Normal file
View File

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

8
plugins/simplemde/languages/en_US.json Executable file → Normal file
View File

@ -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"

8
plugins/simplemde/languages/es_AR.json Executable file → Normal file
View File

@ -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"

10
plugins/simplemde/languages/fr_FR.json Executable file → Normal file
View File

@ -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"
}

0
plugins/simplemde/plugin.php Executable file → Normal file
View File

0
plugins/tags/languages/en_US.json Executable file → Normal file
View File

0
plugins/tags/languages/fr_FR.json Executable file → Normal file
View File

0
plugins/tags/plugin.php Executable file → Normal file
View File

0
themes/pure/css/blog.css Executable file → Normal file
View File

0
themes/pure/languages/en_US.json Executable file → Normal file
View File