Exemple #1
0
 if (strpos($gb_request_uri, gb::$categories_prefix) === 0) {
     # category(ies)
     $categories = array_map('urldecode', explode(',', substr($gb_request_uri, strlen(gb::$categories_prefix))));
     $postspage = GBExposedContent::findByCategories($categories, isset($_REQUEST['page']) ? intval($_REQUEST['page']) : 0);
     gb::$is_categories = true;
     gb::$is_404 = $postspage === false;
 } elseif (strpos($gb_request_uri, gb::$tags_prefix) === 0) {
     # tag(s)
     $tags = array_map('urldecode', explode(',', substr($gb_request_uri, strlen(gb::$tags_prefix))));
     $postspage = GBExposedContent::findByTags($tags, isset($_REQUEST['page']) ? intval($_REQUEST['page']) : 0);
     gb::$is_tags = true;
     gb::$is_404 = $postspage === false;
 } elseif (strpos($gb_request_uri, gb::$feed_prefix) === 0) {
     # feed
     $postspage = GBPost::pageByPageno(0);
     gb::$is_feed = true;
     gb::event('will-handle-request');
     # if we got this far it means no event observers took over this task, so
     # we run the built-in feed (Atom) code:
     require gb::$dir . '/helpers/feed.php';
     exit;
 } elseif (gb::$posts_prefix === '' || ($strptime = strptime($gb_request_uri, gb::$posts_prefix)) !== false) {
     # post
     if ($preview_pathspec !== null) {
         $post = GBPost::findByName($preview_pathspec, $version);
     } else {
         $post = GBPost::find(urldecode($gb_request_uri), $version, $strptime);
     }
     if ($post === false) {
         gb::$is_404 = true;
     } else {