Esempio n. 1
0
        } else {
            # page
            if ($preview_pathspec !== null) {
                $post = GBPage::findByName($preview_pathspec, $version);
            } else {
                $post = GBPage::find(urldecode($gb_request_uri), $version);
            }
            if ($post === false) {
                gb::$is_404 = true;
            } else {
                gb::$title[] = $post->title;
            }
            gb::$is_page = true;
        }
        # post 404?
        if (isset($post) && $post && gb::$is_preview === false && ($post->draft === true || $post->published->time > time())) {
            gb::$is_404 = true;
        }
    } else {
        # posts
        $postspage = GBPost::pageByPageno(isset($_REQUEST['page']) ? intval($_REQUEST['page']) : 0);
        gb::$is_posts = true;
        gb::$is_404 = $postspage === false;
    }
    # unset temporary variables (not polluting global namespace)
    unset($preview_pathspec);
    unset($strptime);
    unset($version);
    gb::event('will-handle-request');
    # from here on, the caller will have to do the rest
}