diff --git a/admin/controllers/dashboard.php b/admin/controllers/dashboard.php
index 7bc1095a..e8fd8e7d 100644
--- a/admin/controllers/dashboard.php
+++ b/admin/controllers/dashboard.php
@@ -1,7 +1,16 @@
-regenerate();
-$dbPages->regenerate();
+// ============================================================================
+// Functions
+// ============================================================================
-?>
+// ============================================================================
+// POST Method
+// ============================================================================
+
+// ============================================================================
+// Main
+// ============================================================================
+
+$_newPosts = $dbPosts->regenerate();
+$_newPages = $dbPages->regenerate();
diff --git a/admin/controllers/settings.php b/admin/controllers/settings.php
index 3b9d3bff..c6285dfa 100644
--- a/admin/controllers/settings.php
+++ b/admin/controllers/settings.php
@@ -21,6 +21,15 @@ function setSettings($args)
$args['advancedOptions'] = 'false';
}
+ // Add slash at the begin and end.
+ // This fields are in the settings->advanced mode
+ if(isset($args['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( $Site->set($args) ) {
Alert::set('Settings has been saved successfully');
}
diff --git a/admin/themes/default/css/default.css b/admin/themes/default/css/default.css
index 2e1a9984..6656a014 100644
--- a/admin/themes/default/css/default.css
+++ b/admin/themes/default/css/default.css
@@ -8,6 +8,10 @@ a:hover {
text-decoration: none !important;
}
+body {
+ background-color: #f9f9f9;
+}
+
/* ----------- FONTS AWESOME ----------- */
.fa-right {
margin-right: 5px;
@@ -55,7 +59,7 @@ a:hover {
}
#sidebar li {
- border-bottom: 1px solid #eee;
+
}
/* ----------- ALERT ----------- */
@@ -78,6 +82,70 @@ h2.title {
font-weight: normal;
}
+/* ----------- TABLE ----------- */
+table {
+ background-color: #fff;
+}
+table thead {
+ border-bottom: 2px solid #ccc;
+}
+
+/* ----------- DASHBOARD ----------- */
+div.dashboardBox {
+ box-shadow: 0 1px 2px rgba(0,0,0,.26);
+ background-color: #fff;
+ border-radius: 2px;
+ box-sizing: border-box;
+ margin-bottom: 20px;
+}
+
+div.dashboardBox div.content {
+ border-top: 1px solid #ddd;
+ padding: 10px 20px;
+}
+
+div.dashboardBox div.contentBlue {
+ background-color: #64b5f6 !important;
+ color: #e3f2fd !important;
+ position: relative;
+ overflow: hidden;
+}
+
+div.dashboardBox div.contentGreen {
+ background-color: #81c784 !important;
+ color: #e8f5e9 !important;
+ position: relative;
+ overflow: hidden;
+}
+
+div.dashboardBox .nav {
+ margin: 0 !important;
+}
+
+
+
+div.dashboardBox i.iconContent {
+ bottom: -1rem;
+ position: absolute;
+ right: 0;
+ font-size: 4em;
+}
+
+div.dashboardBox div.bigContent {
+ font-size: 1.8em;
+ font-weight: bold;
+}
+
+div.dashboardBox h2 {
+ color: #666;
+ font-size: 1.1em;
+ font-weight: normal;
+ margin: 0;
+ padding: 10px 20px;
+}
+
+
+
/* ----------- FORMS ----------- */
form h4 {
@@ -99,12 +167,12 @@ p.advOptions {
/* ----------- PLUGINS ----------- */
div.pluginBox {
- background: rgba(234, 234, 234, 0.18) none repeat scroll 0 0;
+ box-shadow: 0 1px 2px rgba(0,0,0,.26);
+ background-color: #fff;
border-radius: 2px;
- padding: 10px;
+ box-sizing: border-box;
+ padding: 20px;
width: 70%;
- box-shadow: 0 2px 5px 0 rgba(183, 183, 183, 0.26);
- margin-bottom: 20px;
}
div.pluginBox p {
diff --git a/admin/views/dashboard.php b/admin/views/dashboard.php
index bfb28c1c..355a96be 100644
--- a/admin/views/dashboard.php
+++ b/admin/views/dashboard.php
@@ -1,2 +1,55 @@
Dashboard
-Not implemented...
+
+
+
+
+
+
+
+
+
+
Database regenerated
+
New posts and pages synchronized.
+
+
+
+
+
+
Notifications
+
+
+
+ New comment
+ Admin session started at 07:00pm
+ Failed login with username diego
+ Database regenerated
+ New session started at 01:00pm
+ New post added
+ New page added
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/admin/views/edit-page.php b/admin/views/edit-page.php
index da8d346f..18bfcea5 100644
--- a/admin/views/edit-page.php
+++ b/admin/views/edit-page.php
@@ -11,7 +11,7 @@
Content HTML and Markdown code supported.
-
+
-
+title()); ?>
Title
diff --git a/admin/views/users.php b/admin/views/users.php
index 08da0ecb..578506a0 100644
--- a/admin/views/users.php
+++ b/admin/views/users.php
@@ -29,4 +29,4 @@
}
?>
-
+
\ No newline at end of file
diff --git a/kernel/abstract/dbjson.class.php b/kernel/abstract/dbjson.class.php
index 1abf1083..cceeaf37 100644
--- a/kernel/abstract/dbjson.class.php
+++ b/kernel/abstract/dbjson.class.php
@@ -16,8 +16,7 @@ class dbJSON
{
$lines = file($file);
- if($firstLine)
- {
+ if($firstLine) {
// Remove the first line.
unset($lines[0]);
}
@@ -32,6 +31,11 @@ class dbJSON
}
}
+ public function count()
+ {
+ return count($this->db);
+ }
+
public function save()
{
if($this->firstLine)
diff --git a/kernel/abstract/filecontent.class.php b/kernel/abstract/filecontent.class.php
index 439635a6..702b5486 100644
--- a/kernel/abstract/filecontent.class.php
+++ b/kernel/abstract/filecontent.class.php
@@ -7,8 +7,9 @@ class fileContent
function __construct($pathSlug)
{
- if($this->build($pathSlug)===false)
+ if($this->build($pathSlug)===false) {
$this->vars = false;
+ }
}
// Return true if valid
@@ -42,9 +43,6 @@ class fileContent
return false;
}
- // Path
- //$this->setField('path', $this->path);
-
// Database Key
$this->setField('key', $pathSlug);
@@ -84,7 +82,10 @@ class fileContent
array_unshift($output, $parts[1]);
}
- $this->vars['content'] = implode($output);
+ $implode = implode($output);
+
+ // Sanitize content.
+ $this->vars['content'] = Sanitize::html($implode);
}
}
diff --git a/kernel/boot/init.php b/kernel/boot/init.php
index bb570604..ab585a05 100644
--- a/kernel/boot/init.php
+++ b/kernel/boot/init.php
@@ -54,13 +54,15 @@ define('JSON', function_exists('json_encode'));
// TRUE if new posts hand-made set published, or FALSE for draft.
define('HANDMADE_PUBLISHED', true);
+define('CHARSET', 'UTF-8');
+
if(MB_STRING)
{
// Tell PHP that we're using UTF-8 strings until the end of the script.
- mb_internal_encoding('UTF-8');
+ mb_internal_encoding(CHARSET);
// Tell PHP that we'll be outputting UTF-8 to the browser.
- mb_http_output('UTF-8');
+ mb_http_output(CHARSET);
}
// Abstract Classes
diff --git a/kernel/dblanguage.class.php b/kernel/dblanguage.class.php
index 9b92e53c..5585f4e7 100644
--- a/kernel/dblanguage.class.php
+++ b/kernel/dblanguage.class.php
@@ -2,12 +2,12 @@
class dbLanguage extends dbJSON
{
- public $en_EN;
+ public $en_US;
function __construct($language)
{
- parent::__construct(PATH_LANGUAGES.'en_EN.json', false);
- $this->en_EN = $this->db;
+ parent::__construct(PATH_LANGUAGES.'en_US.json', false);
+ $this->en_US = $this->db;
parent::__construct(PATH_LANGUAGES.$language.'.json', false);
}
@@ -22,7 +22,7 @@ class dbLanguage extends dbJSON
return $this->db[$key];
// If the key is not translated then return the English translation.
- return $this->en_EN[$key];
+ return $this->en_US[$key];
}
// Print the translation.
diff --git a/kernel/dbpages.class.php b/kernel/dbpages.class.php
index c457feb2..1f47d0e4 100644
--- a/kernel/dbpages.class.php
+++ b/kernel/dbpages.class.php
@@ -146,7 +146,7 @@ class dbPages extends dbJSON
}
}
- // Make the directory. Recursive.
+ // Move the directory from old key to new key.
if($newKey!==$args['key'])
{
if( Filesystem::mv(PATH_PAGES.$args['key'], PATH_PAGES.$newKey) === false ) {
@@ -157,7 +157,7 @@ class dbPages extends dbJSON
// Make the index.txt and save the file.
$data = implode("\n", $dataForFile);
- if( file_put_contents(PATH_PAGES.$newKey.'/index.txt', $data) === false ) {
+ if( file_put_contents(PATH_PAGES.$newKey.DS.'index.txt', $data) === false ) {
Log::set(__METHOD__.LOG_SEP.'Error occurred when trying to put the content in the file index.txt');
return false;
}
@@ -183,7 +183,7 @@ class dbPages extends dbJSON
}
// Delete the index.txt file.
- if( Filesystem::rmfile(PATH_PAGES.$key.'/index.txt') === false ) {
+ if( Filesystem::rmfile(PATH_PAGES.$key.DS.'index.txt') === false ) {
Log::set(__METHOD__.LOG_SEP.'Error occurred when trying to delete the file index.txt');
}
@@ -313,18 +313,18 @@ class dbPages extends dbJSON
{
$key = basename($directory);
- if(file_exists($directory.'/index.txt')){
+ if(file_exists($directory.DS.'index.txt')){
// The key is the directory name
$paths[$key] = true;
}
// Recovery pages from subdirectories
- $subPaths = glob($directory.'/*', GLOB_ONLYDIR);
+ $subPaths = glob($directory.DS.'*', GLOB_ONLYDIR);
foreach($subPaths as $subDirectory)
{
$subKey = basename($subDirectory);
- if(file_exists($subDirectory.'/index.txt')) {
+ if(file_exists($subDirectory.DS.'index.txt')) {
// The key is composed by the directory/subdirectory
$paths[$key.'/'.$subKey] = true;
}
@@ -347,7 +347,7 @@ class dbPages extends dbJSON
return false;
}
- return true;
+ return $this->db!=$db;
}
}
diff --git a/kernel/dbposts.class.php b/kernel/dbposts.class.php
index bd2ce5e6..42dc56f6 100644
--- a/kernel/dbposts.class.php
+++ b/kernel/dbposts.class.php
@@ -113,7 +113,7 @@ class dbPosts extends dbJSON
// Make the index.txt and save the file.
$data = implode("\n", $dataForFile);
- if( file_put_contents(PATH_POSTS.$key.'/index.txt', $data) === false ) {
+ if( file_put_contents(PATH_POSTS.$key.DS.'index.txt', $data) === false ) {
Log::set(__METHOD__.LOG_SEP.'Error occurred when trying to put the content in the file index.txt');
return false;
}
@@ -150,7 +150,7 @@ class dbPosts extends dbJSON
}
// Delete the index.txt file.
- if( Filesystem::rmfile(PATH_POSTS.$key.'/index.txt') === false ) {
+ if( Filesystem::rmfile(PATH_POSTS.$key.DS.'index.txt') === false ) {
Log::set(__METHOD__.LOG_SEP.'Error occurred when trying to delete the file index.txt');
}
@@ -195,8 +195,9 @@ class dbPosts extends dbJSON
// Username
$fields['username'] = 'admin';
- if(HANDMADE_PUBLISHED)
+ if(HANDMADE_PUBLISHED) {
$fields['status']='published';
+ }
// Recovery pages from the first level of directories
$tmpPaths = glob(PATH_POSTS.'*', GLOB_ONLYDIR);
@@ -204,7 +205,7 @@ class dbPosts extends dbJSON
{
$key = basename($directory);
- if(file_exists($directory.'/index.txt')) {
+ if(file_exists($directory.DS.'index.txt')) {
// The key is the directory name
$paths[$key] = true;
}
@@ -220,7 +221,13 @@ class dbPosts extends dbJSON
$this->db[$slug] = $fields;
}
- $this->save();
+ // Save the database.
+ if( $this->save() === false ) {
+ Log::set(__METHOD__.LOG_SEP.'Error occurred when trying to save the database file.');
+ return false;
+ }
+
+ return $this->db!=$db;
}
public function getPage($pageNumber, $postPerPage, $draftPosts=false)
diff --git a/kernel/dbsite.class.php b/kernel/dbsite.class.php
index 088d1edb..b5b8209c 100644
--- a/kernel/dbsite.class.php
+++ b/kernel/dbsite.class.php
@@ -9,7 +9,7 @@ class dbSite extends dbJSON
'footer'=> array('inFile'=>false, 'value'=>''),
'postsperpage'=>array('inFile'=>false, 'value'=>''),
'language'=> array('inFile'=>false, 'value'=>'en'),
- 'locale'=> array('inFile'=>false, 'value'=>'en_EN'),
+ 'locale'=> array('inFile'=>false, 'value'=>'en_US'),
'timezone'=> array('inFile'=>false, 'value'=>'America/Argentina/Buenos_Aires'),
'theme'=> array('inFile'=>false, 'value'=>'pure'),
'adminTheme'=> array('inFile'=>false, 'value'=>'kure'),
diff --git a/kernel/helpers/sanitize.class.php b/kernel/helpers/sanitize.class.php
index 7ba07b16..65c1021b 100644
--- a/kernel/helpers/sanitize.class.php
+++ b/kernel/helpers/sanitize.class.php
@@ -5,7 +5,7 @@ class Sanitize {
// new
public static function html($text)
{
- return htmlspecialchars($text, ENT_QUOTES, 'UTF-8');
+ return htmlspecialchars($text, ENT_COMPAT|ENT_HTML5, CHARSET);
}
public static function pathFile($path, $file)
diff --git a/kernel/helpers/text.class.php b/kernel/helpers/text.class.php
index e8666a8d..047715ea 100644
--- a/kernel/helpers/text.class.php
+++ b/kernel/helpers/text.class.php
@@ -4,6 +4,23 @@ class Text {
// New
+ public static function addSlashes($text, $begin=true, $end=true)
+ {
+ if($begin) {
+ $text = '/' . ltrim($text, '/');
+ }
+
+ if($end) {
+ $text = rtrim($text, '/') . '/';
+ }
+
+ if($text=='//') {
+ return '/';
+ }
+
+ return $text;
+ }
+
public static function endsWith($string, $endsString)
{
$endsPosition = (-1)*self::length($endsString);
diff --git a/kernel/language.class.php b/kernel/language.class.php
deleted file mode 100644
index a750da8d..00000000
--- a/kernel/language.class.php
+++ /dev/null
@@ -1,36 +0,0 @@
-en_EN = $this->vars;
-
- parent::__construct(PATH_LANGUAGES.$language.'.json', false);
- }
-
- // Return the translation, if the translation does'n exist then return the English translation.
- public function get($text)
- {
- $key = Text::lowercase($text);
- $key = Text::replace(' ', '-', $key);
-
- if(isset($this->vars[$key]))
- return $this->vars[$key];
-
- // If the key is not translated then return the English translation.
- return $this->en_EN[$key];
- }
-
- // Print the translation.
- public function p($text)
- {
- echo $this->get($text);
- }
-
-}
-
-?>