public
Description: The ultra-lightweight ultra-flexible blogging engine with a fetish for birds and misspellings.
Homepage: http://chyrp.net/
Clone URL: git://github.com/vito/chyrp.git
Click here to lend your support to: chyrp and make a donation at www.pledgie.com !
When attempting to view a post and the viewing fails, revert the original 
Route->feed setting.
vito (author)
Sat Nov 01 16:43:53 -0700 2008
commit  8227e88f9aca7b2a8ae48013cd344baf2c54fdae
tree    b01e83478faaca5b568d066e32ddd8b4e67ad17e
parent  2d34862cfd13d2e80e5071cbf182cfb56ac31cae
...
196
197
198
 
 
199
200
 
201
202
203
204
205
206
207
 
208
209
210
...
371
372
373
374
 
375
376
377
378
379
380
 
 
381
 
382
383
384
...
196
197
198
199
200
201
 
202
203
204
205
206
207
208
 
209
210
211
212
...
373
374
375
 
376
377
378
379
380
381
 
382
383
384
385
386
387
388
0
@@ -196,15 +196,17 @@
0
                     if ($parameter[0] == "(")
0
                         $post_url_attrs[rtrim(ltrim($parameter, "("), ")")] = $args[$index];
0
 
0
+                $original_feed = $this->feed;
0
+
0
                 if ((oneof(@$post_url_attrs["url"], @$post_url_attrs["clean"]) == "feed") and # do some checking to see if they're trying
0
-                    (count(explode("/", trim($post_url, "/"))) > count($args) or # to view the post or the post's feed.
0
+                    (count(explode("/", trim($post_url, "/"))) > count($args) or              # to view the post or the post's feed.
0
                      end($args) != "feed"))
0
                     $this->feed = false;
0
 
0
                 if ($return_post)
0
                     return Post::from_url($post_url_attrs);
0
                 else
0
-                    $route->try["view"] = array($post_url_attrs);
0
+                    $route->try["view"] = array($post_url_attrs, $original_feed);
0
             }
0
         }
0
 
0
@@ -371,14 +373,16 @@
0
          * Function: view
0
          * Views a post.
0
          */
0
-        public function view($attrs = null) {
0
+        public function view($attrs = null, $original_feed = false) {
0
             if (isset($attrs))
0
                 $post = Post::from_url($attrs, array("drafts" => true));
0
             else
0
                 $post = new Post(array("url" => @$_GET['url']));
0
 
0
-            if ($post->no_results)
0
+            if ($post->no_results) {
0
+                Route::current()->feed = $original_feed;
0
                 return false;
0
+            }
0
 
0
             if (!$post->theme_exists())
0
                 error(__("Error"), __("The feather theme file for this post does not exist. The post cannot be displayed."));

Comments