Edit-Post: Change publishing Date (no Drafts)

This commit is contained in:
Kanti 2014-09-27 11:30:48 +02:00
commit dfd471ffaa
3 changed files with 10 additions and 5 deletions

View file

@ -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));

View file

@ -49,6 +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>
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>

View file

@ -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)) {