Browse Source

Merge pull request #100 from Kanti/master

Edit-Post: Change publishing Date (no Drafts) by @Kanti.
pull/107/head
Danang Probo Sayekti 11 years ago
parent
commit
84687eb51b
3 changed files with 10 additions and 5 deletions
  1. +5
    -1
      system/admin/admin.php
  2. +1
    -0
      system/admin/views/edit-post.html.php
  3. +4
    -4
      system/htmly.php

+ 5
- 1
system/admin/admin.php View File

@ -43,8 +43,12 @@ function remove_accent($str) {
} }
// Edit blog posts // 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); $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_title = $title;
$post_tag = preg_replace(array('/[^a-zA-Z0-9,.\-\p{L}]/u', '/[ -]+/', '/^-|-$/'), array('', '-', ''), remove_accent($tag)); $post_tag = preg_replace(array('/[^a-zA-Z0-9,.\-\p{L}]/u', '/[ -]+/', '/^-|-$/'), array('', '-', ''), remove_accent($tag));


+ 1
- 0
system/admin/views/edit-post.html.php 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> 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> 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> <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> Meta Description (optional)<br><textarea name="description" maxlength="200"><?php if (isset($p->description)) { echo $p->description;} ?></textarea>
<br><br> <br><br>
<div id="wmd-button-bar" class="wmd-button-bar"></div> <div id="wmd-button-bar" class="wmd-button-bar"></div>


+ 4
- 4
system/htmly.php View File

@ -341,13 +341,13 @@ post('/:year/:month/:name/edit', function() {
$oldfile = from($_REQUEST, 'oldfile'); $oldfile = from($_REQUEST, 'oldfile');
$destination = from($_GET, 'destination'); $destination = from($_GET, 'destination');
$description = from($_REQUEST, 'description'); $description = from($_REQUEST, 'description');
$date = from($_REQUEST, 'date');
if ($proper && !empty($title) && !empty($tag) && !empty($content)) { 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; $url = $title;
edit_post($title, $tag, $url, $content, $oldfile, $destination, $description);
} }
edit_post($title, $tag, $url, $content, $oldfile, $destination, $description, $date);
} else { } else {
$message['error'] = ''; $message['error'] = '';
if (empty($title)) { if (empty($title)) {


Loading…
Cancel
Save