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