Example #1
0
        $var = 'linkPost';
    } elseif (isset($current->quote)) {
        $var = 'quotePost';
    } elseif (isset($current->audio)) {
        $var = 'audioPost';
    } elseif (isset($current->video)) {
        $var = 'videoPost';
    } else {
        $var = 'blogPost';
    }
    if (config('blog.enable') === 'true') {
        $blog = ' <span typeof="v:Breadcrumb"><a property="v:title" rel="v:url" href="' . site_url() . 'blog">Blog</a></span> &#187; ';
    } else {
        $blog = '';
    }
    render('post', array('title' => $current->title . ' - ' . blog_title(), 'description' => $current->description, 'canonical' => $current->url, 'p' => $current, 'author' => $author, 'bodyclass' => 'inpost', 'breadcrumb' => '<span typeof="v:Breadcrumb"><a property="v:title" rel="v:url" href="' . site_url() . '">' . config('breadcrumb.home') . '</a></span> &#187; ' . $blog . '<span typeof="v:Breadcrumb">' . $current->categoryb . '</span>' . ' &#187; ' . $current->title, 'prev' => has_prev($prev), 'next' => has_next($next), 'type' => $var, 'is_post' => true));
});
// Edit blog post
get('/:year/:month/:name/edit', function ($year, $month, $name) {
    if (login()) {
        $user = $_SESSION[config("site.url")]['user'];
        $role = user('role', $user);
        config('views.root', 'system/admin/views');
        $post = find_post($year, $month, $name);
        if (!$post) {
            $post = find_draft($year, $month, $name);
            if (!$post) {
                not_found();
            }
        }
        $current = $post['current'];
Example #2
0
    if (isset($bio[0])) {
        $bio = $bio[0];
    } else {
        $bio = default_profile($current->author);
    }
    if (array_key_exists('prev', $post)) {
        $prev = $post['prev'];
    } else {
        $prev = array();
    }
    if (array_key_exists('next', $post)) {
        $next = $post['next'];
    } else {
        $next = array();
    }
    render('post', array('head_contents' => head_contents($current->title . ' - ' . blog_title(), $current->description, $current->url), 'p' => $current, 'authorinfo' => authorinfo($bio->title, $bio->body), 'bodyclass' => 'inpost', 'breadcrumb' => '<span typeof="v:Breadcrumb"><a property="v:title" rel="v:url" href="' . site_url() . '">' . config('breadcrumb.home') . '</a></span> &#187; ' . $current->tagb . ' &#187; ' . $current->title, 'prev' => has_prev($prev), 'next' => has_next($next), 'type' => 'blogpost'));
});
// Edit blog post
get('/:year/:month/:name/edit', function ($year, $month, $name) {
    if (login()) {
        $user = $_SESSION[config("site.url")]['user'];
        $role = user('role', $user);
        config('views.root', 'system/admin/views');
        $post = find_post($year, $month, $name);
        if (!$post) {
            not_found();
        }
        $current = $post['current'];
        if ($user === $current->author || $role === 'admin') {
            render('edit-post', array('head_contents' => head_contents('Edit post - ' . blog_title(), blog_description(), site_url()), 'p' => $current, 'bodyclass' => 'editpost', 'breadcrumb' => '<span typeof="v:Breadcrumb"><a property="v:title" rel="v:url" href="' . site_url() . '">' . config('breadcrumb.home') . '</a></span> &#187; ' . $current->tagb . ' &#187; ' . $current->title));
        } else {