Example #1
0
<?php

$Blogs = new PerchBlog_Blogs($API);
$Posts = new PerchBlog_Posts($API);
$message = false;
$Authors = new PerchBlog_Authors();
$Author = $Authors->find_or_create($CurrentUser);
$HTML = $API->get('HTML');
if (!$CurrentUser->has_priv('perch_blog.post.create')) {
    PerchUtil::redirect($API->app_path());
}
if (isset($_GET['id']) && $_GET['id'] != '') {
    $postID = (int) $_GET['id'];
    $Post = $Posts->find($postID, true);
    $details = $Post->to_array();
    $template = $Post->postMetaTemplate();
}
$Blog = false;
if (PERCH_RUNWAY) {
    if ($Post) {
        $Blog = $Post->get_blog();
    } else {
        if (PerchUtil::get('blog')) {
            $Blog = $Blogs->find((int) PerchUtil::get('blog'));
        }
    }
}
if (!$Blog) {
    $Blog = $Blogs->find(1);
}
$Sections = new PerchBlog_Sections();