diff --git a/README.md b/README.md
index d34923e..4db089c 100644
--- a/README.md
+++ b/README.md
@@ -55,13 +55,13 @@ Rename `config.ini.example` inside the `config` folder to `config.ini` (or you c
Create `YourUsername.ini` inside the `config/users` folder or simply rename the `username.ini.example` file and write down your password there:
-````
+````cfg
password = YourPassword
````
HTMLy support admin user role either, simply add the following to your choosen user:
-````
+````cfg
role = admin
````
@@ -72,7 +72,7 @@ You can login to admin panel at `www.example.com/login`.
### Lighttpd
Here a example configuration
-````
+````php
$HTTP["url"] =~ "^/config" {
url.access-deny = ( "" )
}
@@ -95,7 +95,7 @@ url.rewrite-once = (
### Nginx
Here a basic configuration for nginx.
-````
+````nginx
server {
listen 80;
@@ -165,13 +165,13 @@ That means the URL is `about/me`.
Content Title
-------------
If you write it offline, for the title of the post you need to add a title in the following format:
+```html
+
-
-
- Paragraph 1
-
- Paragraph 2 etc.
+Paragraph 1
+Paragraph 2 etc.
+```
So wrap the title with HTML comment with `t` for both side.
Demo
diff --git a/system/admin/admin.php b/system/admin/admin.php
index 19c2ff2..295a22c 100644
--- a/system/admin/admin.php
+++ b/system/admin/admin.php
@@ -59,7 +59,7 @@ function remove_accent($str)
}
// Edit blog posts
-function edit_post($title, $tag, $url, $content, $oldfile, $destination = null, $description = null, $date = null)
+function edit_post($title, $tag, $url, $content, $oldfile, $destination = null, $description = null, $date = null, $fi, $vid)
{
$oldurl = explode('_', $oldfile);
if ($date !== null) {
@@ -67,6 +67,8 @@ function edit_post($title, $tag, $url, $content, $oldfile, $destination = null,
}
$post_title = $title;
+ $post_fi = $fi;
+ $post_vid = $vid;
$post_tag = preg_replace(array('/[^a-zA-Z0-9,.\-\p{L}]/u', '/[ -]+/', '/^-|-$/'), array('', '-', ''), remove_accent($tag));
$post_url = strtolower(preg_replace(array('/[^a-zA-Z0-9 \-\p{L}]/u', '/[ -]+/', '/^-|-$/'), array('', '-', ''), remove_accent($url)));
if ($description !== null) {
@@ -75,6 +77,7 @@ function edit_post($title, $tag, $url, $content, $oldfile, $destination = null,
$post_description = "";
}
$post_content = '' . $post_description . "\n\n" . $content;
+ $post_content = '' . "\n\n" . '' . "\n\n" . $post_content;
if (!empty($post_title) && !empty($post_tag) && !empty($post_url) && !empty($post_content)) {
if (get_magic_quotes_gpc()) {
@@ -152,11 +155,13 @@ function edit_page($title, $url, $content, $oldfile, $destination = null, $descr
}
// Add blog post
-function add_post($title, $tag, $url, $content, $user, $description = null)
+function add_post($title, $tag, $url, $content, $user, $description = null, $fi, $vid)
{
-
+
$post_date = date('Y-m-d-H-i-s');
$post_title = $title;
+ $post_fi = $fi;
+ $post_vid = $vid;
$post_tag = preg_replace(array('/[^a-zA-Z0-9,.\-\p{L}]/u', '/[ -]+/', '/^-|-$/'), array('', '-', ''), remove_accent($tag));
$post_url = strtolower(preg_replace(array('/[^a-zA-Z0-9 \-\p{L}]/u', '/[ -]+/', '/^-|-$/'), array('', '-', ''), remove_accent($url)));
if ($description !== null) {
@@ -165,6 +170,7 @@ function add_post($title, $tag, $url, $content, $user, $description = null)
$post_description = "";
}
$post_content = '' . $post_description . "\n\n" . $content;
+ $post_content = '' . "\n\n" . '' . "\n\n" . $post_content;
if (!empty($post_title) && !empty($post_tag) && !empty($post_url) && !empty($post_content)) {
if (get_magic_quotes_gpc()) {
diff --git a/system/admin/views/add-post.html.php b/system/admin/views/add-post.html.php
index 62a9b4a..ee686b5 100644
--- a/system/admin/views/add-post.html.php
+++ b/system/admin/views/add-post.html.php
@@ -13,6 +13,8 @@
If the url leave empty we will use the post title.
Meta Description (optional)
+ Featured Image (optional)
+ Embed Youtube Video (optional)
@@ -28,4 +30,4 @@
editor.run();
})();
-
\ No newline at end of file
+
diff --git a/system/admin/views/edit-post.html.php b/system/admin/views/edit-post.html.php
index da9b086..8fe7e76 100644
--- a/system/admin/views/edit-post.html.php
+++ b/system/admin/views/edit-post.html.php
@@ -8,6 +8,8 @@
$content = file_get_contents($url);
$oldtitle = get_content_tag('t',$content,'Untitled');
+ $oldfi = get_content_tag('fi',$content);
+ $oldvid = get_content_tag('vid',$content);
$oldcontent = remove_html_comments($content);
$dir = substr($url, 0, strrpos($url, '/'));
@@ -52,6 +54,8 @@
Date Time
Meta Description (optional)
+ Featured Image (optional)
+ Embed Youtube Video (optional)
@@ -68,4 +72,4 @@
editor.run();
})();
-
\ No newline at end of file
+
diff --git a/system/htmly.php b/system/htmly.php
index bbe4d16..122d68b 100644
--- a/system/htmly.php
+++ b/system/htmly.php
@@ -333,6 +333,8 @@ post('/:year/:month/:name/edit', function () {
$proper = is_csrf_proper(from($_REQUEST, 'csrf_token'));
$title = from($_REQUEST, 'title');
+ $fi = from($_REQUEST, 'fi');
+ $vid = from($_REQUEST, 'vid');
$tag = from($_REQUEST, 'tag');
$url = from($_REQUEST, 'url');
$content = from($_REQUEST, 'content');
@@ -350,7 +352,7 @@ post('/:year/:month/:name/edit', function () {
if(empty($url)) {
$url = $title;
}
- edit_post($title, $tag, $url, $content, $oldfile, $destination, $description, $dateTime);
+ edit_post($title, $tag, $url, $content, $oldfile, $destination, $description, $dateTime, $fi, $vid);
} else {
$message['error'] = '';
if (empty($title)) {
@@ -372,6 +374,8 @@ post('/:year/:month/:name/edit', function () {
'error' => '' . $message['error'] . ' ',
'oldfile' => $oldfile,
'postTitle' => $title,
+ 'postFi' => $fi,
+ 'postVid' => $vid,
'postTag' => $tag,
'postUrl' => $url,
'postContent' => $content,
@@ -874,6 +878,8 @@ post('/add/post', function () {
$proper = is_csrf_proper(from($_REQUEST, 'csrf_token'));
$title = from($_REQUEST, 'title');
+ $fi = from($_REQUEST, 'fi');
+ $vid = from($_REQUEST, 'vid');
$tag = from($_REQUEST, 'tag');
$url = from($_REQUEST, 'url');
$content = from($_REQUEST, 'content');
@@ -881,10 +887,10 @@ post('/add/post', function () {
$user = $_SESSION[config("site.url")]['user'];
if ($proper && !empty($title) && !empty($tag) && !empty($content)) {
if (!empty($url)) {
- add_post($title, $tag, $url, $content, $user, $description);
+ add_post($title, $tag, $url, $content, $user, $description, $fi, $vid);
} else {
$url = $title;
- add_post($title, $tag, $url, $content, $user, $description);
+ add_post($title, $tag, $url, $content, $user, $description, $fi, $vid);
}
} else {
$message['error'] = '';
@@ -905,6 +911,8 @@ post('/add/post', function () {
'head_contents' => head_contents('Add post - ' . blog_title(), blog_description(), site_url()),
'error' => '' . $message['error'] . ' ',
'postTitle' => $title,
+ 'postFi' => $fi,
+ 'postVid' => $vid,
'postTag' => $tag,
'postUrl' => $url,
'postContent' => $content,
@@ -932,6 +940,24 @@ get('/add/page', function () {
}
});
+// Add the static page
+get('/add/page', function () {
+
+ if (login()) {
+
+ config('views.root', 'system/admin/views');
+
+ render('add-page', array(
+ 'head_contents' => head_contents('Add page - ' . blog_title(), blog_description(), site_url()),
+ 'bodyclass' => 'addpage',
+ 'breadcrumb' => '' . config('breadcrumb.home') . ' » Add page'
+ ));
+ } else {
+ $login = site_url() . 'login';
+ header("location: $login");
+ }
+});
+
// Get submitted static page data
post('/add/page', function () {
diff --git a/system/includes/functions.php b/system/includes/functions.php
index 73b2390..c495e7a 100644
--- a/system/includes/functions.php
+++ b/system/includes/functions.php
@@ -243,6 +243,8 @@ function get_posts($posts, $page = 1, $perpage = 0)
// Extract the title and body
$post->title = get_content_tag('t', $content, 'Untitled: ' . date('l jS \of F Y', $post->date));
+ $post->feature = get_content_tag('fi', $content);
+ $post->video = get_content_tag('vid', $content);
// Get the contents and convert it to HTML
$post->body = MarkdownExtra::defaultTransform(remove_html_comments($content));
diff --git a/themes/clean/main.html.php b/themes/clean/main.html.php
index 0af2134..aedbe0e 100644
--- a/themes/clean/main.html.php
+++ b/themes/clean/main.html.php
@@ -17,6 +17,16 @@
+ feature)){?>
+
+
+
+
+ video)){?>
+
+ VIDEO
+
+
date)?> - Posted in
tag ?> by
author ?>
@@ -45,4 +55,4 @@
-
\ No newline at end of file
+
diff --git a/themes/clean/post.html.php b/themes/clean/post.html.php
index 060d1cf..099ea99 100644
--- a/themes/clean/post.html.php
+++ b/themes/clean/post.html.php
@@ -5,6 +5,16 @@
title ?>
+ feature)){?>
+
+
+
+
+ video)){?>
+
+ VIDEO
+
+
date)?> - Posted in
tag ?> by
author ?> -
@@ -45,4 +55,4 @@
title, $p->url) ?>
-
\ No newline at end of file
+
diff --git a/themes/default/main.html.php b/themes/default/main.html.php
index 0af2134..aedbe0e 100644
--- a/themes/default/main.html.php
+++ b/themes/default/main.html.php
@@ -17,6 +17,16 @@
+ feature)){?>
+
+
+
+
+ video)){?>
+
+ VIDEO
+
+
date)?> - Posted in
tag ?> by
author ?>
@@ -45,4 +55,4 @@
-
\ No newline at end of file
+
diff --git a/themes/default/post.html.php b/themes/default/post.html.php
index 060d1cf..099ea99 100644
--- a/themes/default/post.html.php
+++ b/themes/default/post.html.php
@@ -5,6 +5,16 @@
title ?>
+ feature)){?>
+
+
+
+
+ video)){?>
+
+ VIDEO
+
+
date)?> - Posted in
tag ?> by
author ?> -
@@ -45,4 +55,4 @@
title, $p->url) ?>
-
\ No newline at end of file
+
diff --git a/themes/logs/main.html.php b/themes/logs/main.html.php
index c78f10a..3bf22d9 100644
--- a/themes/logs/main.html.php
+++ b/themes/logs/main.html.php
@@ -17,6 +17,16 @@
+ feature)){?>
+
+
+
+
+ video)){?>
+
+ VIDEO
+
+
date)?> - Posted in
tag ?> by
author ?>
@@ -45,4 +55,4 @@
-
\ No newline at end of file
+
diff --git a/themes/logs/post.html.php b/themes/logs/post.html.php
index 140782f..f6da39e 100644
--- a/themes/logs/post.html.php
+++ b/themes/logs/post.html.php
@@ -5,6 +5,16 @@
title ?>
+ feature)){?>
+
+
+
+
+ video)){?>
+
+ VIDEO
+
+
date)?> - Posted in
tag ?> by
author ?> -
@@ -45,4 +55,4 @@
title, $p->url) ?>
-
\ No newline at end of file
+