示例#1
0
        $Post->Template = $Template;
        $result = $Post->update_meta($data);
        $Post->index($Template);
    }
    if ($result) {
        $message = $HTML->success_message('Your post has been successfully updated. Return to %spost listing%s', '<a href="' . $API->app_path() . '">', '</a>');
    } else {
        $message = $HTML->failure_message('Sorry, that post could not be updated.');
    }
    $details = $Post->to_array();
    // clear the caches
    PerchBlog_Cache::expire_all();
    // update category post counts;
    $Posts->update_category_counts();
    $Authors->update_post_counts();
    $Sections->update_post_counts();
    // Has the template changed? If so, need to redirect back to kick things off again.
    if ($data['postTemplate'] != $template) {
        #PerchUtil::redirect($API->app_path() .'/edit/?id='.$Post->id().'&edited=1');
    }
}
if (isset($_GET['edited']) && !$message) {
    $message = $HTML->success_message('Your post has been successfully updated. Return to %spost listing%s', '<a href="' . $API->app_path() . '">', '</a>');
}
// is it a draft?
if (is_object($Post) && $Post->postStatus() == 'Draft') {
    $draft = true;
    $message = $Lang->get('%sYou are editing a draft. %sPreview%s', '<p class="alert draft">', '<a href="' . $HTML->encode($Post->previewURL()) . '" class="action draft-preview">', '</a></p>');
} else {
    $draft = false;
    $url = false;