New features
This commit is contained in:
parent
d8fc681b3c
commit
394468a845
12
.htaccess
12
.htaccess
|
@ -1,10 +1,14 @@
|
||||||
AddDefaultCharset UTF-8
|
AddDefaultCharset UTF-8
|
||||||
|
|
||||||
RewriteEngine on
|
# Remove the trailing slash from URL
|
||||||
|
|
||||||
DirectorySlash Off
|
DirectorySlash Off
|
||||||
|
|
||||||
RewriteCond %{REQUEST_FILENAME} !-f
|
# Enable rewrite rules
|
||||||
#RewriteCond %{REQUEST_FILENAME} !-d
|
RewriteEngine on
|
||||||
|
|
||||||
|
# Deny direct access to .txt files
|
||||||
|
RewriteRule ^content/(.*)\.txt$ - [R=404,L]
|
||||||
|
|
||||||
|
# All URL process by index.php
|
||||||
|
RewriteCond %{REQUEST_FILENAME} !-f
|
||||||
RewriteRule ^(.*) index.php [L]
|
RewriteRule ^(.*) index.php [L]
|
|
@ -26,7 +26,7 @@ function editPage($args)
|
||||||
$dbPages->regenerate();
|
$dbPages->regenerate();
|
||||||
|
|
||||||
Alert::set('The page has been saved successfully');
|
Alert::set('The page has been saved successfully');
|
||||||
Redirect::page('admin', 'manage-pages');
|
Redirect::page('admin', 'edit-page/'.$args['key']);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -53,7 +53,7 @@
|
||||||
<label>
|
<label>
|
||||||
Friendly url
|
Friendly url
|
||||||
<div class="input-groups width-50">
|
<div class="input-groups width-50">
|
||||||
<span class="input-prepend"><?php echo $Site->url() ?><span id="parentExample"></span></span>
|
<span class="input-prepend"><?php echo $Site->url() ?><span id="parentExample"><?php echo $_Page->parentKey()?$_Page->parentKey().'/':''; ?></span></span>
|
||||||
<input id="slug" type="text" name="slug" value="<?php echo $_Page->slug() ?>">
|
<input id="slug" type="text" name="slug" value="<?php echo $_Page->slug() ?>">
|
||||||
</div>
|
</div>
|
||||||
<span class="forms-desc">Short text no more than 150 characters. Special characters not allowed.</span>
|
<span class="forms-desc">Short text no more than 150 characters. Special characters not allowed.</span>
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
{
|
{
|
||||||
echo '<tr>';
|
echo '<tr>';
|
||||||
echo '<td><a href="'.HTML_PATH_ADMIN_ROOT.'edit-post/'.$Post->key().'">'.($Post->published()?'':'[DRAFT] ').($Post->title()?$Post->title():'[Empty title] ').'</a></td>';
|
echo '<td><a href="'.HTML_PATH_ADMIN_ROOT.'edit-post/'.$Post->key().'">'.($Post->published()?'':'[DRAFT] ').($Post->title()?$Post->title():'[Empty title] ').'</a></td>';
|
||||||
echo '<td>'.$Post->date().'</td>';
|
echo '<td>'.$Post->dateCreated().'</td>';
|
||||||
echo '<td>'.$Post->timeago().'</td>';
|
echo '<td>'.$Post->timeago().'</td>';
|
||||||
echo '</tr>';
|
echo '</tr>';
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,6 +21,12 @@
|
||||||
<div class="forms-desc">Small and concise description of the field ???</div>
|
<div class="forms-desc">Small and concise description of the field ???</div>
|
||||||
</label>
|
</label>
|
||||||
|
|
||||||
|
<label>
|
||||||
|
Site slogan
|
||||||
|
<input type="text" name="slogan" class="width-50" value="<?php echo $Site->slogan() ?>">
|
||||||
|
<div class="forms-desc">Small and concise description of the field ???</div>
|
||||||
|
</label>
|
||||||
|
|
||||||
<label>
|
<label>
|
||||||
Site description
|
Site description
|
||||||
<input type="text" name="description" class="width-50" value="<?php echo $Site->description() ?>">
|
<input type="text" name="description" class="width-50" value="<?php echo $Site->description() ?>">
|
||||||
|
|
17
install.php
17
install.php
|
@ -6,6 +6,7 @@ define('BLUDIT', true);
|
||||||
define('PATH_ROOT', __DIR__.'/');
|
define('PATH_ROOT', __DIR__.'/');
|
||||||
define('PATH_CONTENT', PATH_ROOT.'content/');
|
define('PATH_CONTENT', PATH_ROOT.'content/');
|
||||||
define('PATH_POSTS', PATH_CONTENT.'posts/');
|
define('PATH_POSTS', PATH_CONTENT.'posts/');
|
||||||
|
define('PATH_UPLOADS', PATH_CONTENT.'uploads/');
|
||||||
define('PATH_PAGES', PATH_CONTENT.'pages/');
|
define('PATH_PAGES', PATH_CONTENT.'pages/');
|
||||||
define('PATH_DATABASES', PATH_CONTENT.'databases/');
|
define('PATH_DATABASES', PATH_CONTENT.'databases/');
|
||||||
define('PATH_PLUGINS_DATABASES', PATH_CONTENT.'databases/plugins/');
|
define('PATH_PLUGINS_DATABASES', PATH_CONTENT.'databases/plugins/');
|
||||||
|
@ -44,6 +45,13 @@ function checkSystem()
|
||||||
$phpModules = get_loaded_extensions();
|
$phpModules = get_loaded_extensions();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(!file_exists(PATH_ROOT.'.htaccess'))
|
||||||
|
{
|
||||||
|
$errorText = 'Missing file, upload the file .htaccess';
|
||||||
|
error_log($errorText, 0);
|
||||||
|
array_push($stdOut, $errorText);
|
||||||
|
}
|
||||||
|
|
||||||
if(!version_compare(phpversion(), '5.2', '>'))
|
if(!version_compare(phpversion(), '5.2', '>'))
|
||||||
{
|
{
|
||||||
$errorText = 'Current PHP version '.phpversion().', but you need > 5.3';
|
$errorText = 'Current PHP version '.phpversion().', but you need > 5.3';
|
||||||
|
@ -107,6 +115,12 @@ function install($adminPassword, $email)
|
||||||
error_log($errorText, 0);
|
error_log($errorText, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(!mkdir(PATH_UPLOADS, $dirpermissions, true))
|
||||||
|
{
|
||||||
|
$errorText = 'Error when trying to created the directory=>'.PATH_UPLOADS;
|
||||||
|
error_log($errorText, 0);
|
||||||
|
}
|
||||||
|
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
// Create files
|
// Create files
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
|
@ -144,7 +158,8 @@ function install($adminPassword, $email)
|
||||||
|
|
||||||
// File site.php
|
// File site.php
|
||||||
$data = array(
|
$data = array(
|
||||||
'title'=>'Bludit CMS',
|
'title'=>'Bludit',
|
||||||
|
'slogan'=>'cms',
|
||||||
'description'=>'',
|
'description'=>'',
|
||||||
'footer'=>'Footer text - ©2015',
|
'footer'=>'Footer text - ©2015',
|
||||||
'language'=>'english',
|
'language'=>'english',
|
||||||
|
|
|
@ -17,6 +17,7 @@ define('PATH_POSTS', PATH_CONTENT.'posts/');
|
||||||
define('PATH_PAGES', PATH_CONTENT.'pages/');
|
define('PATH_PAGES', PATH_CONTENT.'pages/');
|
||||||
define('PATH_DATABASES', PATH_CONTENT.'databases/');
|
define('PATH_DATABASES', PATH_CONTENT.'databases/');
|
||||||
define('PATH_PLUGINS_DATABASES', PATH_CONTENT.'databases/plugins/');
|
define('PATH_PLUGINS_DATABASES', PATH_CONTENT.'databases/plugins/');
|
||||||
|
define('PATH_UPLOADS', PATH_CONTENT.'uploads/');
|
||||||
|
|
||||||
define('PATH_ADMIN_THEMES', PATH_ROOT.'admin/themes/');
|
define('PATH_ADMIN_THEMES', PATH_ROOT.'admin/themes/');
|
||||||
define('PATH_ADMIN_CONTROLLERS', PATH_ROOT.'admin/controllers/');
|
define('PATH_ADMIN_CONTROLLERS', PATH_ROOT.'admin/controllers/');
|
||||||
|
|
|
@ -11,12 +11,14 @@ function buildPost($key)
|
||||||
// Post object.
|
// Post object.
|
||||||
$Post = new Post($key);
|
$Post = new Post($key);
|
||||||
if( !$Post->isValid() ) {
|
if( !$Post->isValid() ) {
|
||||||
|
Log::set(__METHOD__.LOG_SEP.'Error occurred when trying build the post from file with key'.$key);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Page database.
|
// Page database.
|
||||||
$db = $dbPosts->getDb($key);
|
$db = $dbPosts->getDb($key);
|
||||||
if( !$db ) {
|
if( !$db ) {
|
||||||
|
Log::set(__METHOD__.LOG_SEP.'Error occurred when trying build the post from database with key'.$key);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -64,7 +66,7 @@ function build_posts_per_page($pageNumber=0, $amount=5, $draftPosts=false)
|
||||||
$list = $dbPosts->getPage($pageNumber, $amount, $draftPosts);
|
$list = $dbPosts->getPage($pageNumber, $amount, $draftPosts);
|
||||||
|
|
||||||
// There are not post for the pageNumber then NotFound page
|
// There are not post for the pageNumber then NotFound page
|
||||||
if(empty($list)) {
|
if(empty($list) && $pageNumber>0) {
|
||||||
$Url->setNotFound(true);
|
$Url->setNotFound(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -248,10 +248,8 @@ class dbPages extends dbJSON
|
||||||
$newKey = helperText::cleanUrl($parent).'/'.helperText::cleanUrl($text);
|
$newKey = helperText::cleanUrl($parent).'/'.helperText::cleanUrl($text);
|
||||||
}
|
}
|
||||||
|
|
||||||
if($newKey===$oldKey) {
|
if($newKey!==$oldKey)
|
||||||
return $newKey;
|
{
|
||||||
}
|
|
||||||
|
|
||||||
// Verify if the key is already been used.
|
// Verify if the key is already been used.
|
||||||
if( isset($this->db[$newKey]) )
|
if( isset($this->db[$newKey]) )
|
||||||
{
|
{
|
||||||
|
@ -263,6 +261,7 @@ class dbPages extends dbJSON
|
||||||
$newKey++;
|
$newKey++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if($returnSlug)
|
if($returnSlug)
|
||||||
{
|
{
|
||||||
|
|
|
@ -4,6 +4,7 @@ class dbSite extends dbJSON
|
||||||
{
|
{
|
||||||
private $dbFields = array(
|
private $dbFields = array(
|
||||||
'title'=> array('inFile'=>false, 'value'=>''),
|
'title'=> array('inFile'=>false, 'value'=>''),
|
||||||
|
'slogan'=> array('inFile'=>false, 'value'=>''),
|
||||||
'description'=> array('inFile'=>false, 'value'=>''),
|
'description'=> array('inFile'=>false, 'value'=>''),
|
||||||
'footer'=> array('inFile'=>false, 'value'=>''),
|
'footer'=> array('inFile'=>false, 'value'=>''),
|
||||||
'postsperpage'=>array('inFile'=>false, 'value'=>''),
|
'postsperpage'=>array('inFile'=>false, 'value'=>''),
|
||||||
|
@ -90,6 +91,12 @@ class dbSite extends dbJSON
|
||||||
return $this->db['title'];
|
return $this->db['title'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Returns the site slogan.
|
||||||
|
public function slogan()
|
||||||
|
{
|
||||||
|
return $this->db['slogan'];
|
||||||
|
}
|
||||||
|
|
||||||
public function advancedOptions()
|
public function advancedOptions()
|
||||||
{
|
{
|
||||||
if($this->db['advancedOptions']==='true') {
|
if($this->db['advancedOptions']==='true') {
|
||||||
|
|
|
@ -36,6 +36,12 @@ class Page extends fileContent
|
||||||
return $this->getField('tags');
|
return $this->getField('tags');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function tagsArray()
|
||||||
|
{
|
||||||
|
$tags = $this->getField('tags');
|
||||||
|
return explode(',', $tags);
|
||||||
|
}
|
||||||
|
|
||||||
public function position()
|
public function position()
|
||||||
{
|
{
|
||||||
return $this->getField('position');
|
return $this->getField('position');
|
||||||
|
@ -53,17 +59,28 @@ class Page extends fileContent
|
||||||
}
|
}
|
||||||
|
|
||||||
// Returns the post date according to locale settings and format settings.
|
// Returns the post date according to locale settings and format settings.
|
||||||
public function date($format = false)
|
public function dateCreated($format=false)
|
||||||
{
|
|
||||||
if($format!==false)
|
|
||||||
{
|
{
|
||||||
|
if($format===false) {
|
||||||
|
return $this->getField('date');
|
||||||
|
}
|
||||||
|
|
||||||
$unixTimeCreated = $this->unixTimeCreated();
|
$unixTimeCreated = $this->unixTimeCreated();
|
||||||
|
|
||||||
return Date::format($unixTimeCreated, $format);
|
return Date::format($unixTimeCreated, $format);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function dateModified($format=false)
|
||||||
|
{
|
||||||
|
if($format===false) {
|
||||||
return $this->getField('date');
|
return $this->getField('date');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$unixTimeModified = $this->unixTimeModified();
|
||||||
|
|
||||||
|
return Date::format($unixTimeModified, $format);
|
||||||
|
}
|
||||||
|
|
||||||
// Returns the time ago
|
// Returns the time ago
|
||||||
public function timeago()
|
public function timeago()
|
||||||
{
|
{
|
||||||
|
|
|
@ -62,17 +62,28 @@ class Post extends fileContent
|
||||||
return $this->getField('unixTimeModified');
|
return $this->getField('unixTimeModified');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function date($format = false)
|
public function dateCreated($format=false)
|
||||||
{
|
|
||||||
if($format!==false)
|
|
||||||
{
|
{
|
||||||
|
if($format===false) {
|
||||||
|
return $this->getField('date');
|
||||||
|
}
|
||||||
|
|
||||||
$unixTimeCreated = $this->unixTimeCreated();
|
$unixTimeCreated = $this->unixTimeCreated();
|
||||||
|
|
||||||
return Date::format($unixTimeCreated, $format);
|
return Date::format($unixTimeCreated, $format);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function dateModified($format=false)
|
||||||
|
{
|
||||||
|
if($format===false) {
|
||||||
return $this->getField('date');
|
return $this->getField('date');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$unixTimeModified = $this->unixTimeModified();
|
||||||
|
|
||||||
|
return Date::format($unixTimeModified, $format);
|
||||||
|
}
|
||||||
|
|
||||||
public function timeago()
|
public function timeago()
|
||||||
{
|
{
|
||||||
return $this->getField('timeago');
|
return $this->getField('timeago');
|
||||||
|
|
|
@ -22,6 +22,33 @@ p {
|
||||||
margin: 10px 0 0 0;
|
margin: 10px 0 0 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
img {
|
||||||
|
display: block;
|
||||||
|
max-width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
table {
|
||||||
|
empty-cells: show;
|
||||||
|
border: 1px solid #cbcbcb;
|
||||||
|
}
|
||||||
|
|
||||||
|
thead {
|
||||||
|
background-color: #e0e0e0;
|
||||||
|
color: #000;
|
||||||
|
text-align: left;
|
||||||
|
vertical-align: bottom;
|
||||||
|
}
|
||||||
|
|
||||||
|
tr {
|
||||||
|
display: table-row;
|
||||||
|
vertical-align: inherit;
|
||||||
|
border-color: inherit;
|
||||||
|
}
|
||||||
|
|
||||||
|
th, td {
|
||||||
|
padding: 0.5em 1em;
|
||||||
|
}
|
||||||
|
|
||||||
#layout {
|
#layout {
|
||||||
padding: 0;
|
padding: 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,8 +21,7 @@
|
||||||
));
|
));
|
||||||
|
|
||||||
Theme::css(array(
|
Theme::css(array(
|
||||||
'http://fonts.googleapis.com/css?family=Open+Sans:400,300,600&subset=latin,cyrillic-ext,greek-ext,greek,vietnamese,cyrillic,latin-ext',
|
'http://fonts.googleapis.com/css?family=Open+Sans:400,300,600&subset=latin,cyrillic-ext,greek-ext,greek,vietnamese,cyrillic,latin-ext'
|
||||||
'http://fonts.googleapis.com/css?family=Muli:400,300'
|
|
||||||
), '');
|
), '');
|
||||||
|
|
||||||
// <script src="rainbow.min.js"></script>
|
// <script src="rainbow.min.js"></script>
|
||||||
|
@ -32,10 +31,10 @@
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
|
<!-- Pure and Google Fonts -->
|
||||||
<style>
|
<style>
|
||||||
html, button, input, select, textarea,
|
html, button, input, select, textarea,
|
||||||
.pure-g [class *= "pure-u"] {
|
.pure-g [class *= "pure-u"] {
|
||||||
/* Set your content font stack here: */
|
|
||||||
font-family: 'Open Sans', sans-serif;
|
font-family: 'Open Sans', sans-serif;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<section class="page">
|
<section class="page">
|
||||||
<header class="page-head">
|
<header class="page-head">
|
||||||
<h1 class="page-title">
|
<h1 class="page-title">
|
||||||
<?php echo $Page->title() ?>
|
# <?php echo $Page->title() ?>
|
||||||
</h1>
|
</h1>
|
||||||
</header>
|
</header>
|
||||||
|
|
||||||
|
|
|
@ -1,34 +1,40 @@
|
||||||
<div class="header">
|
<div class="header">
|
||||||
|
|
||||||
<h1>Bludit</h1>
|
<h1><?php echo $Site->title() ?></h1>
|
||||||
<h2>cms</h2>
|
<h2><?php echo $Site->slogan() ?></h2>
|
||||||
<p class="about">Simple and fast content management system, create a site in 1 minute. Created by Diego Najar @dignajar</p>
|
<p class="about"><?php echo $Site->description() ?></p>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
// POSTS
|
// Links
|
||||||
echo '<div class="links">';
|
echo '<div class="links">';
|
||||||
echo '<a class="homelink" href="'.HTML_PATH_ROOT.'">Home</a>';
|
echo '<a class="homelink" href="'.HTML_PATH_ROOT.'">Home</a>';
|
||||||
echo '<span> | </span>';
|
echo '<span> | </span>';
|
||||||
echo '<a class="homelink" href="'.HTML_PATH_ROOT.'">Twitter</a>';
|
echo '<a class="homelink" href="'.HTML_PATH_ROOT.'">Twitter</a>';
|
||||||
echo '</div>';
|
echo '</div>';
|
||||||
|
|
||||||
// PAGES
|
// Pages
|
||||||
|
$parents = $pagesParents[NO_PARENT_CHAR];
|
||||||
|
|
||||||
|
foreach($parents as $parent)
|
||||||
|
|
||||||
unset($pagesParents[NO_PARENT_CHAR]);
|
|
||||||
foreach($pagesParents as $parentKey=>$pageList)
|
|
||||||
{
|
{
|
||||||
echo '<a class="parent" href="'.HTML_PATH_ROOT.$parentKey.'">'.$pages[$parentKey]->title().'</a>';
|
// Print the parent
|
||||||
|
echo '<a class="parent" href="'.HTML_PATH_ROOT.$parent->key().'">'.$parent->title().'</a>';
|
||||||
|
|
||||||
|
// Check if the parent hash children
|
||||||
|
if(isset($pagesParents[$parent->key()]))
|
||||||
|
{
|
||||||
|
$children = $pagesParents[$parent->key()];
|
||||||
|
|
||||||
|
// Print the children
|
||||||
echo '<ul>';
|
echo '<ul>';
|
||||||
foreach($pageList as $tmpPage)
|
foreach($children as $child)
|
||||||
{
|
{
|
||||||
echo '<li><a class="children" href="'.HTML_PATH_ROOT.$tmpPage->key().'">'.$tmpPage->title().'</a></li>';
|
echo '<li><a class="children" href="'.HTML_PATH_ROOT.$child->key().'">'.$child->title().'</a></li>';
|
||||||
}
|
}
|
||||||
echo '</ul>';
|
echo '</ul>';
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue