Bugs fixes

This commit is contained in:
dignajar 2015-08-22 13:33:33 -03:00
parent 9d3de43d9e
commit 8c0522e9c2
9 changed files with 199 additions and 153 deletions

View File

@ -190,6 +190,12 @@ function install($adminPassword, $email)
error_log($errorText, 0); error_log($errorText, 0);
} }
if(!mkdir(PATH_PLUGINS_DATABASES.'tinymce', $dirpermissions, true))
{
$errorText = 'Error when trying to created the directory=>'.PATH_PLUGINS_DATABASES;
error_log($errorText, 0);
}
if(!mkdir(PATH_UPLOADS, $dirpermissions, true)) if(!mkdir(PATH_UPLOADS, $dirpermissions, true))
{ {
$errorText = 'Error when trying to created the directory=>'.PATH_UPLOADS; $errorText = 'Error when trying to created the directory=>'.PATH_UPLOADS;
@ -282,15 +288,24 @@ function install($adminPassword, $email)
file_put_contents(PATH_DATABASES.'security.php', $dataHead.json_encode($data, JSON_PRETTY_PRINT), LOCK_EX); file_put_contents(PATH_DATABASES.'security.php', $dataHead.json_encode($data, JSON_PRETTY_PRINT), LOCK_EX);
// File plugins/pages/db.php // File plugins/pages/db.php
$data = array( $data = array(
'homeLink'=>true, 'homeLink'=>true,
'label'=>$Language->get('Pages') 'label'=>$Language->get('Pages'),
'position'=>'0'
); );
file_put_contents(PATH_PLUGINS_DATABASES.'pages'.DS.'db.php', $dataHead.json_encode($data, JSON_PRETTY_PRINT), LOCK_EX); file_put_contents(PATH_PLUGINS_DATABASES.'pages'.DS.'db.php', $dataHead.json_encode($data, JSON_PRETTY_PRINT), LOCK_EX);
// File plugins/tinymce/db.php
$data = array(
'plugins'=>'autoresize, fullscreen, pagebreak, link, textcolor, code',
'toolbar'=>'bold italic underline strikethrough | alignleft aligncenter alignright | bullist numlist | styleselect | link forecolor backcolor removeformat | pagebreak code fullscreen',
'position'=>'0'
);
file_put_contents(PATH_PLUGINS_DATABASES.'tinymce'.DS.'db.php', $dataHead.json_encode($data, JSON_PRETTY_PRINT), LOCK_EX);
// File index.txt for error page // File index.txt for error page
$data = 'Title: '.$Language->get('Error').' $data = 'Title: '.$Language->get('Error').'
Content: '.$Language->get('The page has not been found'); Content: '.$Language->get('The page has not been found');

View File

@ -64,8 +64,10 @@ function build_page($key)
$Page->setField('contentRaw', $Page->content(), true); $Page->setField('contentRaw', $Page->content(), true);
// Parse markdown content. // Parse markdown content.
$content = $Parsedown->text($contentRaw); // Parse Markdown. $content = Text::pre2htmlentities($contentRaw); // Parse pre code with htmlentities
$content = $Parsedown->text($content); // Parse Markdown.
$content = Text::imgRel2Abs($content, HTML_PATH_UPLOADS); // Parse img src relative to absolute. $content = Text::imgRel2Abs($content, HTML_PATH_UPLOADS); // Parse img src relative to absolute.
$content = Text::pre2htmlentities($content); // Parse pre code with htmlentities
$Page->setField('content', $content, true); $Page->setField('content', $content, true);
// Parse username for the page. // Parse username for the page.

View File

@ -53,7 +53,8 @@ function buildPost($key)
$Post->setField('contentRaw', $contentRaw, true); $Post->setField('contentRaw', $contentRaw, true);
// Parse the content // Parse the content
$content = $Parsedown->text($contentRaw); // Parse Markdown. $content = Text::pre2htmlentities($contentRaw); // Parse pre code with htmlentities
$content = $Parsedown->text($content); // Parse Markdown.
$content = Text::imgRel2Abs($content, HTML_PATH_UPLOADS); // Parse img src relative to absolute. $content = Text::imgRel2Abs($content, HTML_PATH_UPLOADS); // Parse img src relative to absolute.
$Post->setField('content', $content, true); $Post->setField('content', $content, true);
@ -68,7 +69,7 @@ function buildPost($key)
$user = $dbUsers->getDb( $Post->username() ); $user = $dbUsers->getDb( $Post->username() );
$Post->setField('authorFirstName', $user['firstName'], false); $Post->setField('authorFirstName', $user['firstName'], false);
$Post->setField('authorLastName', $user['lastName'], false); $Post->setField('authorLastName', $user['lastName'], false);
} }

View File

@ -110,8 +110,14 @@ class dbPages extends dbJSON
} }
// Unix time created and modified. // Unix time created and modified.
$args['unixTimeCreated'] = $this->db[$args['key']]['unixTimeCreated']; // If the page is a draft then the time created is now.
$args['unixTimeModified'] = Date::unixTime(); if( $this->db[$args['key']]['status']=='draft' ) {
$args['unixTimeCreated'] = Date::unixTime();
}
else {
$args['unixTimeCreated'] = $this->db[$args['key']]['unixTimeCreated'];
$args['unixTimeModified'] = Date::unixTime();
}
// Verify arguments with the database fields. // Verify arguments with the database fields.
foreach($this->dbFields as $field=>$options) foreach($this->dbFields as $field=>$options)

View File

@ -3,15 +3,15 @@
class dbPosts extends dbJSON class dbPosts extends dbJSON
{ {
private $dbFields = array( private $dbFields = array(
'title'=> array('inFile'=>true, 'value'=>''), 'title'=> array('inFile'=>true, 'value'=>''),
'content'=> array('inFile'=>true, 'value'=>''), 'content'=> array('inFile'=>true, 'value'=>''),
'description'=> array('inFile'=>false, 'value'=>''), 'description'=> array('inFile'=>false, 'value'=>''),
'username'=> array('inFile'=>false, 'value'=>''), 'username'=> array('inFile'=>false, 'value'=>''),
'status'=> array('inFile'=>false, 'value'=>'draft'), 'status'=> array('inFile'=>false, 'value'=>'draft'),
'tags'=> array('inFile'=>false, 'value'=>''), 'tags'=> array('inFile'=>false, 'value'=>''),
'allowComments'=> array('inFile'=>false, 'value'=>false), 'allowComments'=> array('inFile'=>false, 'value'=>false),
'unixTimeCreated'=> array('inFile'=>false, 'value'=>0), 'unixTimeCreated'=> array('inFile'=>false, 'value'=>0),
'unixTimeModified'=>array('inFile'=>false, 'value'=>0) 'unixTimeModified'=> array('inFile'=>false, 'value'=>0)
); );
private $numberPosts = array( private $numberPosts = array(
@ -157,8 +157,14 @@ class dbPosts extends dbJSON
public function edit($args) public function edit($args)
{ {
// Unix time created and modified. // Unix time created and modified.
$args['unixTimeCreated'] = $this->db[$args['key']]['unixTimeCreated']; // If the page is a draft then the time created is now.
$args['unixTimeModified'] = Date::unixTime(); if( $this->db[$args['key']]['status']=='draft' ) {
$args['unixTimeCreated'] = Date::unixTime();
}
else {
$args['unixTimeCreated'] = $this->db[$args['key']]['unixTimeCreated'];
$args['unixTimeModified'] = Date::unixTime();
}
if( $this->delete($args['key']) ) { if( $this->delete($args['key']) ) {
return $this->add($args); return $this->add($args);

View File

@ -171,7 +171,15 @@ class Text {
public static function imgRel2Abs($string, $base) public static function imgRel2Abs($string, $base)
{ {
return preg_replace('/(src)="([^:"]*)(?:")/', "$1=\"$base$2\"", $string); return preg_replace('/(?!code).(src)="([^:"]*)(?:")/', "$1=\"$base$2\"", $string);
}
public static function pre2htmlentities($string)
{
return preg_replace_callback('/<pre.*?><code(.*?)>(.*?)<\/code><\/pre>/imsu',
create_function('$input', 'return "<pre><code $input[1]>".htmlentities($input[2])."</code></pre>";'),
$string);
} }
} }

View File

@ -1,121 +1,123 @@
/* ------------------------
Default tags
------------------------ */
* { * {
-webkit-box-sizing: border-box; -webkit-box-sizing: border-box;
-moz-box-sizing: border-box; -moz-box-sizing: border-box;
box-sizing: border-box; box-sizing: border-box;
} }
a { a {
text-decoration: none; text-decoration: none;
color: #2672ec; color: #2672ec;
} }
a:hover, a:hover,
a:focus a:focus
{ {
text-decoration: none; text-decoration: none;
} }
p { p {
margin: 10px 0 0 0; margin: 10px 0 0 0;
} }
img { img {
display: block; display: block;
max-width: 100%; max-width: 100%;
} }
table { table {
empty-cells: show; empty-cells: show;
border: 1px solid #cbcbcb; border: 1px solid #cbcbcb;
} }
thead { thead {
background-color: #e0e0e0; background-color: #e0e0e0;
color: #000; color: #000;
text-align: left; text-align: left;
vertical-align: bottom; vertical-align: bottom;
} }
tr { tr {
display: table-row; display: table-row;
vertical-align: inherit; vertical-align: inherit;
border-color: inherit; border-color: inherit;
} }
th, td { th, td {
padding: 0.5em 1em; padding: 0.5em 1em;
} }
pre, code { pre, code {
white-space: pre-wrap !important; white-space: pre-wrap !important;
} }
code {
font-size: 13px !important;
}
.subhead { /* ------------------------
text-transform: uppercase; Content / Main
color: #aaa; ------------------------ */
border-bottom: 1px solid #eee; #layout {
padding: 0.4em 0; padding: 0;
font-size: 80%;
font-weight: 500;
letter-spacing: 0.1em;
} }
.content { .content {
padding-top: 3em; padding: 2em 1em 0;
margin-right: 30px;
margin-left: 30px;
} }
#layout { .subhead {
padding: 0; text-transform: uppercase;
color: #aaa;
border-bottom: 1px solid #eee;
padding: 0.4em 0;
font-size: 80%;
font-weight: 500;
letter-spacing: 0.1em;
} }
div.footer { .footer {
font-size: 0.9em; font-size: 0.9em;
color: #999; color: #999;
text-align: center; text-align: center;
margin: 30px 0; margin: 30px 0;
} }
/* ------------------------ /* ------------------------
Paginator Paginator
------------------------ */ ------------------------ */
#paginator { #paginator {
margin: 20px 0; margin: 20px 0;
} }
#paginator a { #paginator a {
color: #2672ec; color: #2672ec;
} }
#paginator ul { #paginator ul {
clear: both; clear: both;
list-style-type: none; list-style-type: none;
margin: 0; margin: 0;
overflow: auto; overflow: auto;
padding: 0; padding: 0;
} }
#paginator li { #paginator li {
display: block; display: block;
} }
#paginator li.left { #paginator li.left {
float: left !important; float: left !important;
} }
#paginator li.list { #paginator li.list {
background: #e0e0e0; background: #e0e0e0;
color: #747474; color: #747474;
padding: 2px 11px; padding: 2px 11px;
} }
#paginator li.right { #paginator li.right {
float: right !important; float: right !important;
} }
/* ------------------------ /* ------------------------
@ -123,165 +125,168 @@ Pages and Posts
------------------------ */ ------------------------ */
.page, .page,
.post { .post {
margin: 0 0 70px 0; margin: 0 0 70px 0;
} }
.page-title, .page-title,
.post-title .post-title
{ {
font-size: 2.4em; font-size: 2.4em;
margin: 0; margin: 0;
} }
.page-title a, .page-title a,
.post-title a .post-title a
{ {
color: #555; color: #555;
border-bottom: 5px solid #ccc; border-bottom: 5px solid #ccc;
display: inline-block; display: inline-block;
} }
.page a.read-more, .page a.read-more,
.post a.read-more{ .post a.read-more{
display: block; display: block;
text-align: center; text-align: center;
padding: 2px 5px; padding: 2px 5px;
} }
.page-content, .page-content,
.post-content { .post-content {
color: #444; color: #444;
line-height: 1.7em; line-height: 1.7em;
margin-top: 22px; margin-top: 22px;
} }
.page-content hr, .page-content hr,
.post-content hr { .post-content hr {
display: block; display: block;
height: 1px; height: 1px;
border: 0; border: 0;
border-top: 1px solid #ccc; border-top: 1px solid #ccc;
margin: 30px 0; margin: 30px 0;
padding: 0; padding: 0;
} }
.page-content h2, .page-content h2,
.post-content h2 .post-content h2
{ {
color: #555; color: #555;
margin: 30px 0 30px 0; margin: 30px 0 30px 0;
font-size: 2em; font-size: 2em;
font-weight: normal; font-weight: normal;
} }
.page-content h3, .page-content h3,
.post-content h3 .post-content h3
{ {
color: #555; color: #555;
margin: 35px 0 25px 0; margin: 35px 0 25px 0;
font-size: 1.5em; font-size: 1.5em;
font-weight: normal; font-weight: normal;
} }
.page-content h4, .page-content h4,
.post-content h4 .post-content h4
{ {
color: #555; color: #555;
margin: 25px 0 15px 0; margin: 25px 0 15px 0;
font-size: 1.2em; font-size: 1.2em;
font-weight: lighter; font-weight: lighter;
} }
.post-meta, .post-meta,
.page-meta { .page-meta {
font-size: 90%; font-size: 90%;
margin: 0; margin: 0;
} }
.post-meta span.date, .post-meta span.date,
.page-meta span.date { .page-meta span.date {
color: #999; color: #999;
margin-right: 10px; margin-right: 10px;
} }
.post-meta span.author, .post-meta span.author,
.page-meta span.author { .page-meta span.author {
color: #ccc; color: #ccc;
} }
/* ------------------------ /* ------------------------
Sidebar Sidebar
------------------------ */ ------------------------ */
.sidebar { .sidebar {
margin: 60px 30px 0; background: #f1f1f1;
}
.sidebar-content {
padding: 30px 10px 0 30px;
} }
.sidebar a { .sidebar a {
color: #555; color: #555;
} }
.sidebar a:hover { .sidebar a:hover {
color: #000; color: #000;
} }
.sidebar h1.title { .sidebar h1.title {
font-size: 3.2em; font-size: 3.2em;
font-weight: lighter; font-weight: lighter;
margin: 0; margin: 0;
padding: 0; padding: 0;
} }
.sidebar h2.slogan { .sidebar h2.slogan {
font-size: 2.2em; font-size: 2.2em;
font-weight: lighter; font-weight: lighter;
margin: -10px 0 0 0; margin: -10px 0 0 0;
padding: 0; padding: 0;
} }
/* ------------------------ /* ------------------------
Plugins Plugins
------------------------ */ ------------------------ */
div.plugin { div.plugin {
margin-top: 40px; margin-top: 40px;
} }
div.plugin h2 { div.plugin h2 {
border-bottom: 1px solid #ccc; border-bottom: 1px solid #ccc;
color: #ccc; color: #ccc;
display: inline-block; display: inline-block;
font-size: 1em; font-size: 1em;
margin-bottom: 5px; margin-bottom: 5px;
} }
div.plugin-content { div.plugin-content {
padding: 0 10px; padding: 0 10px;
} }
div.plugin-content li { div.plugin-content li {
margin-top: 5px; margin-top: 5px;
} }
div.plugin-content ul { div.plugin-content ul {
display: block; display: block;
list-style-type: none; list-style-type: none;
margin: 5px 0; margin: 5px 0;
padding: 0; padding: 0;
} }
div.plugin-content ul > li > ul > li { div.plugin-content ul > li > ul > li {
margin: 0; margin: 0;
} }
div.plugin-content ul > li > ul > li:before { div.plugin-content ul > li > ul > li:before {
color: #777; color: #777;
content: "—"; content: "—";
padding-right: 5px; padding-right: 5px;
} }
div.plugin-content ul > li > ul > li > a { div.plugin-content ul > li > ul > li > a {
color: #777; color: #777;
} }
/* ------------------------ /* ------------------------
@ -289,15 +294,15 @@ Responsive
------------------------ */ ------------------------ */
@media (min-width: 48em) { @media (min-width: 48em) {
.content { .content {
padding: 1em 3em 0; padding: 1em 3em 0;
margin-left: 25%; margin-left: 25%;
} }
.sidebar { .sidebar {
position: fixed; position: fixed;
top: 0; top: 0;
bottom: 0; bottom: 0;
overflow: auto; overflow: auto;
} }
} }

View File

@ -5,7 +5,7 @@
* @version 1.0.4 * @version 1.0.4
*/ */
pre { pre {
border: 1px solid #ccc; border: 1px solid #E7E9EE;
word-wrap: break-word; word-wrap: break-word;
padding: 6px 10px; padding: 6px 10px;
line-height: 19px; line-height: 19px;
@ -13,10 +13,9 @@ pre {
} }
code { code {
border: 1px solid #eaeaea; border: 1px solid #E7E9EE;
margin: 0px 2px; margin: 0px 2px;
padding: 0px 5px; padding: 0px 5px;
font-size: 12px;
} }
pre code { pre code {
@ -30,8 +29,8 @@ pre code {
pre, code { pre, code {
font-family: Consolas, 'Liberation Mono', Courier, monospace; font-family: Consolas, 'Liberation Mono', Courier, monospace;
color: #333; background: #f8faff none repeat scroll 0 0;
background: #f8f8f8; color: #211fab;
-moz-border-radius: 3px; -moz-border-radius: 3px;
-webkit-border-radius: 3px; -webkit-border-radius: 3px;
border-radius: 3px; border-radius: 3px;

View File

@ -1,5 +1,9 @@
<div class="sidebar-content">
<h1 class="title"><?php echo $Site->title() ?></h1> <h1 class="title"><?php echo $Site->title() ?></h1>
<h2 class="slogan"><?php echo $Site->slogan() ?></h2> <h2 class="slogan"><?php echo $Site->slogan() ?></h2>
<!-- Plugins Sidebar --> <!-- Plugins Sidebar -->
<?php Theme::plugins('siteSidebar') ?> <?php Theme::plugins('siteSidebar') ?>
</div>