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);
}
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))
{
$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 plugins/pages/db.php
$data = array(
'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 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
$data = 'Title: '.$Language->get('Error').'
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);
// 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::pre2htmlentities($content); // Parse pre code with htmlentities
$Page->setField('content', $content, true);
// Parse username for the page.

View File

@ -53,7 +53,8 @@ function buildPost($key)
$Post->setField('contentRaw', $contentRaw, true);
// 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.
$Post->setField('content', $content, true);

View File

@ -110,8 +110,14 @@ class dbPages extends dbJSON
}
// Unix time created and modified.
// If the page is a draft then the time created is now.
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.
foreach($this->dbFields as $field=>$options)

View File

@ -157,8 +157,14 @@ class dbPosts extends dbJSON
public function edit($args)
{
// Unix time created and modified.
// If the page is a draft then the time created is now.
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']) ) {
return $this->add($args);

View File

@ -171,7 +171,15 @@ class Text {
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,3 +1,7 @@
/* ------------------------
Default tags
------------------------ */
* {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
@ -50,8 +54,16 @@ pre, code {
white-space: pre-wrap !important;
}
code {
font-size: 13px !important;
/* ------------------------
Content / Main
------------------------ */
#layout {
padding: 0;
}
.content {
padding: 2em 1em 0;
}
.subhead {
@ -64,17 +76,7 @@ code {
letter-spacing: 0.1em;
}
.content {
padding-top: 3em;
margin-right: 30px;
margin-left: 30px;
}
#layout {
padding: 0;
}
div.footer {
.footer {
font-size: 0.9em;
color: #999;
text-align: center;
@ -213,9 +215,12 @@ Pages and Posts
/* ------------------------
Sidebar
------------------------ */
.sidebar {
margin: 60px 30px 0;
background: #f1f1f1;
}
.sidebar-content {
padding: 30px 10px 0 30px;
}
.sidebar a {

View File

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

View File

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