Skip to content

Commit

Permalink
Merge pull request #101 from Kanti/master
Browse files Browse the repository at this point in the history
Added time to Publish date by @Kanti.
  • Loading branch information
danpros committed Sep 27, 2014
2 parents 84687eb + e6c8c3f commit 15494c0
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 3 deletions.
2 changes: 2 additions & 0 deletions config/config.ini.example
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
2 changes: 1 addition & 1 deletion system/admin/admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion system/admin/views/edit-post.html.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
Tag <span class="required">*</span> <br><input type="text" name="tag" class="text <?php if (isset($postTag)) { if (empty($postTag)) { echo 'error';}} ?>" value="<?php echo $oldtag?>"/><br><br>
Url (optional)<br><input type="text" name="url" class="text" value="<?php echo $oldmd ?>"/><br>
<span class="help">If the url leave empty we will use the post title.</span><br><br>
Date<br><input type="date" name="date" class="text" value="<?php echo $timestamp; ?>"><br><br>
Date Time<br><input type="date" name="date" class="text" value="<?php echo $timestamp; ?>"><br><input type="time" name="time" class="text" value="<?php echo $time->format('H:i'); ?>"><br><br>
Meta Description (optional)<br><textarea name="description" maxlength="200"><?php if (isset($p->description)) { echo $p->description;} ?></textarea>
<br><br>
<div id="wmd-button-bar" class="wmd-button-bar"></div>
Expand Down
12 changes: 11 additions & 1 deletion system/htmly.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@

// 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
Expand Down Expand Up @@ -342,12 +346,18 @@
$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)) {
Expand Down

0 comments on commit 15494c0

Please sign in to comment.