From e6c8c3f2c76e41d5c14e5b7af1c2e54ce8501828 Mon Sep 17 00:00:00 2001 From: Kanti Date: Sat, 27 Sep 2014 14:06:03 +0200 Subject: [PATCH] Added time to Publish date --- config/config.ini.example | 2 ++ system/admin/admin.php | 2 +- system/admin/views/edit-post.html.php | 2 +- system/htmly.php | 12 +++++++++++- 4 files changed, 15 insertions(+), 3 deletions(-) diff --git a/config/config.ini.example b/config/config.ini.example index 824739a..a296c1c 100644 --- a/config/config.ini.example +++ b/config/config.ini.example @@ -1,6 +1,8 @@ ; The URL of your blog. Include the http or https. site.url = "" +timezone = "Asia/Jakarta" + ; Blog info blog.title = "HTMLy" blog.tagline = "Just another HTMLy blog" diff --git a/system/admin/admin.php b/system/admin/admin.php index fe5a8cf..e3e52ac 100644 --- a/system/admin/admin.php +++ b/system/admin/admin.php @@ -47,7 +47,7 @@ function edit_post($title, $tag, $url, $content, $oldfile, $destination = null, $oldurl = explode('_', $oldfile); if($date !== null) { - $oldurl[0] = substr($oldurl[0],0,-19) . date('Y-m-d-h-m-s',strtotime($date)); + $oldurl[0] = substr($oldurl[0],0,-19) . date('Y-m-d-h-i-s',strtotime($date)); } $post_title = $title; diff --git a/system/admin/views/edit-post.html.php b/system/admin/views/edit-post.html.php index 9a12604..da9b086 100644 --- a/system/admin/views/edit-post.html.php +++ b/system/admin/views/edit-post.html.php @@ -49,7 +49,7 @@ Tag *


Url (optional)

If the url leave empty we will use the post title.

- Date


+ Date Time



Meta Description (optional)


diff --git a/system/htmly.php b/system/htmly.php index 3cc6991..5ba5c15 100644 --- a/system/htmly.php +++ b/system/htmly.php @@ -14,6 +14,10 @@ include 'system/includes/opml.php'; // Load the configuration file config('source', 'config/config.ini'); +if(config('timezone')) +{ + date_default_timezone_set(config('timezone')); +} // The front page of the blog. // This will match the root url @@ -342,12 +346,18 @@ post('/:year/:month/:name/edit', function() { $destination = from($_GET, 'destination'); $description = from($_REQUEST, 'description'); $date = from($_REQUEST, 'date'); + $time = from($_REQUEST, 'time'); + $dateTime = null; + if($date !== null && $time !== null) + { + $dateTime = $date . ' ' . $time; + } if ($proper && !empty($title) && !empty($tag) && !empty($content)) { if(empty($url)) { $url = $title; } - edit_post($title, $tag, $url, $content, $oldfile, $destination, $description, $date); + edit_post($title, $tag, $url, $content, $oldfile, $destination, $description, $dateTime); } else { $message['error'] = ''; if (empty($title)) {