diff --git a/system/admin/admin.php b/system/admin/admin.php index 728cab7..fe5a8cf 100644 --- a/system/admin/admin.php +++ b/system/admin/admin.php @@ -43,8 +43,12 @@ function remove_accent($str) { } // Edit blog posts -function edit_post($title, $tag, $url, $content, $oldfile, $destination = null, $description = null) { +function edit_post($title, $tag, $url, $content, $oldfile, $destination = null, $description = null, $date = null) { $oldurl = explode('_', $oldfile); + if($date !== null) + { + $oldurl[0] = substr($oldurl[0],0,-19) . date('Y-m-d-h-m-s',strtotime($date)); + } $post_title = $title; $post_tag = preg_replace(array('/[^a-zA-Z0-9,.\-\p{L}]/u', '/[ -]+/', '/^-|-$/'), array('', '-', ''), remove_accent($tag)); diff --git a/system/admin/views/edit-post.html.php b/system/admin/views/edit-post.html.php index aa91a8b..9a12604 100644 --- a/system/admin/views/edit-post.html.php +++ b/system/admin/views/edit-post.html.php @@ -49,6 +49,7 @@ Tag *


Url (optional)

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

+ Date


Meta Description (optional)


diff --git a/system/htmly.php b/system/htmly.php index eb92b66..3cc6991 100644 --- a/system/htmly.php +++ b/system/htmly.php @@ -341,13 +341,13 @@ post('/:year/:month/:name/edit', function() { $oldfile = from($_REQUEST, 'oldfile'); $destination = from($_GET, 'destination'); $description = from($_REQUEST, 'description'); + $date = from($_REQUEST, 'date'); + if ($proper && !empty($title) && !empty($tag) && !empty($content)) { - if (!empty($url)) { - edit_post($title, $tag, $url, $content, $oldfile, $destination, $description); - } else { + if(empty($url)) { $url = $title; - edit_post($title, $tag, $url, $content, $oldfile, $destination, $description); } + edit_post($title, $tag, $url, $content, $oldfile, $destination, $description, $date); } else { $message['error'] = ''; if (empty($title)) {