From 899389b6ae0520ae720b6aaaf3a573c0b9bf1259 Mon Sep 17 00:00:00 2001 From: Kanti Date: Thu, 8 Jan 2015 14:01:12 +0100 Subject: [PATCH 01/12] Update README.md --- README.md | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 02916756..82f034f5 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 From 04d8c567a7074e481722f3740b121a4b87c8f966 Mon Sep 17 00:00:00 2001 From: Mohamad Fahmi Date: Sat, 7 Feb 2015 17:37:44 +0700 Subject: [PATCH 02/12] Update htmly.php Add Featured Image & Embed Video --- system/htmly.php | 32 +++++++++++++++++++++++++++++--- 1 file changed, 29 insertions(+), 3 deletions(-) diff --git a/system/htmly.php b/system/htmly.php index 8241bfd2..c05c01eb 100644 --- a/system/htmly.php +++ b/system/htmly.php @@ -334,6 +334,8 @@ $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'); @@ -351,7 +353,7 @@ 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)) { @@ -373,6 +375,8 @@ 'error' => '', 'oldfile' => $oldfile, 'postTitle' => $title, + 'postFi' => $fi, + 'postVid' => $vid, 'postTag' => $tag, 'postUrl' => $url, 'postContent' => $content, @@ -875,6 +879,8 @@ $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'); @@ -882,10 +888,10 @@ $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'] = ''; @@ -906,6 +912,8 @@ 'head_contents' => head_contents('Add post - ' . blog_title(), blog_description(), site_url()), 'error' => '', 'postTitle' => $title, + 'postFi' => $fi, + 'postVid' => $vid, 'postTag' => $tag, 'postUrl' => $url, 'postContent' => $content, @@ -933,6 +941,24 @@ } }); +// 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 () { From 6be89b62ad14d1d9c8878f5d169a870222b84d9c Mon Sep 17 00:00:00 2001 From: Mohamad Fahmi Date: Sat, 7 Feb 2015 17:39:22 +0700 Subject: [PATCH 03/12] Update functions.php FI & Video --- system/includes/functions.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/system/includes/functions.php b/system/includes/functions.php index 73b2390b..c495e7af 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)); From 142a77a2bb37b1dd719c7107d6a06b09d80cf196 Mon Sep 17 00:00:00 2001 From: Mohamad Fahmi Date: Sat, 7 Feb 2015 17:41:09 +0700 Subject: [PATCH 04/12] Update admin.php FI & Video --- system/admin/admin.php | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/system/admin/admin.php b/system/admin/admin.php index 19c2ff28..295a22cc 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()) { From 9eead8400497f908be86d480844934ba421814ab Mon Sep 17 00:00:00 2001 From: Mohamad Fahmi Date: Sat, 7 Feb 2015 17:41:44 +0700 Subject: [PATCH 05/12] Update addpost FI & Video --- system/admin/views/add-post.html.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/system/admin/views/add-post.html.php b/system/admin/views/add-post.html.php index 62a9b4a6..ee686b53 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 + From 4e34d0faa9be8674d864315de020df6e6a3fed59 Mon Sep 17 00:00:00 2001 From: Mohamad Fahmi Date: Sat, 7 Feb 2015 17:42:20 +0700 Subject: [PATCH 06/12] edit post FI & Video --- system/admin/views/edit-post.html.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/system/admin/views/edit-post.html.php b/system/admin/views/edit-post.html.php index da9b0868..8fe7e76b 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 + From 4bc0fda7a0dca6f72e2c12b3ccfda7551e3bf471 Mon Sep 17 00:00:00 2001 From: Mohamad Fahmi Date: Sat, 7 Feb 2015 17:43:18 +0700 Subject: [PATCH 07/12] main FI & Video --- themes/clean/main.html.php | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/themes/clean/main.html.php b/themes/clean/main.html.php index 0af21345..aedbe0e9 100644 --- a/themes/clean/main.html.php +++ b/themes/clean/main.html.php @@ -17,6 +17,16 @@

title ?>

+ feature)){?> + + + video)){?> + + - Posted in tag ?> by @@ -45,4 +55,4 @@ - \ No newline at end of file + From 02f72e51a84c898f7d97021a7d2201c63d851239 Mon Sep 17 00:00:00 2001 From: Mohamad Fahmi Date: Sat, 7 Feb 2015 17:43:58 +0700 Subject: [PATCH 08/12] post view FI & Video --- themes/clean/post.html.php | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/themes/clean/post.html.php b/themes/clean/post.html.php index 060d1cf7..099ea992 100644 --- a/themes/clean/post.html.php +++ b/themes/clean/post.html.php @@ -5,6 +5,16 @@

title ?>

+ feature)){?> + + + video)){?> + + - Posted in tag ?> by - @@ -45,4 +55,4 @@ title, $p->url) ?> -
\ No newline at end of file +
From c73c09c4510f471516ac05d235ee08dbd472beb4 Mon Sep 17 00:00:00 2001 From: Mohamad Fahmi Date: Sat, 7 Feb 2015 17:44:38 +0700 Subject: [PATCH 09/12] main FI & Vid --- themes/default/main.html.php | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/themes/default/main.html.php b/themes/default/main.html.php index 0af21345..aedbe0e9 100644 --- a/themes/default/main.html.php +++ b/themes/default/main.html.php @@ -17,6 +17,16 @@

title ?>

+ feature)){?> + + + video)){?> + + - Posted in tag ?> by @@ -45,4 +55,4 @@ - \ No newline at end of file + From f811f760ff4277c9e82c56f134667ae2744f652b Mon Sep 17 00:00:00 2001 From: Mohamad Fahmi Date: Sat, 7 Feb 2015 17:45:07 +0700 Subject: [PATCH 10/12] post Fi & Vid --- themes/default/post.html.php | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/themes/default/post.html.php b/themes/default/post.html.php index 060d1cf7..099ea992 100644 --- a/themes/default/post.html.php +++ b/themes/default/post.html.php @@ -5,6 +5,16 @@

title ?>

+ feature)){?> + + + video)){?> + + - Posted in tag ?> by - @@ -45,4 +55,4 @@ title, $p->url) ?> -
\ No newline at end of file +
From 0c69057915e25c7a73067b917e2d363a5dbc4bf3 Mon Sep 17 00:00:00 2001 From: Mohamad Fahmi Date: Sat, 7 Feb 2015 17:45:36 +0700 Subject: [PATCH 11/12] main Fi & Vid --- themes/logs/main.html.php | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/themes/logs/main.html.php b/themes/logs/main.html.php index c78f10af..3bf22d93 100644 --- a/themes/logs/main.html.php +++ b/themes/logs/main.html.php @@ -17,6 +17,16 @@

title ?>

+ feature)){?> + + + video)){?> + + - Posted in tag ?> by @@ -45,4 +55,4 @@ - \ No newline at end of file + From 60b5e23860496ebf3ed1b93bacb2b45abe9b5809 Mon Sep 17 00:00:00 2001 From: Mohamad Fahmi Date: Sat, 7 Feb 2015 17:46:01 +0700 Subject: [PATCH 12/12] post Fi & Vid --- themes/logs/post.html.php | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/themes/logs/post.html.php b/themes/logs/post.html.php index 140782f9..f6da39ee 100644 --- a/themes/logs/post.html.php +++ b/themes/logs/post.html.php @@ -5,6 +5,16 @@

title ?>

+ feature)){?> + + + video)){?> + + - Posted in tag ?> by - @@ -45,4 +55,4 @@ title, $p->url) ?> -
\ No newline at end of file +