From 2389d66da849798f8d4ec5f10e3b07c11da49185 Mon Sep 17 00:00:00 2001 From: Michael Francis Date: Sat, 28 May 2011 13:28:16 -0400 Subject: Initial Commit --- controllers/FeedsController.php | 79 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 79 insertions(+) create mode 100644 controllers/FeedsController.php (limited to 'controllers/FeedsController.php') diff --git a/controllers/FeedsController.php b/controllers/FeedsController.php new file mode 100644 index 0000000..dfbd5f3 --- /dev/null +++ b/controllers/FeedsController.php @@ -0,0 +1,79 @@ +redirect('Users::login'); + } + + //else + //Figure out what user is logged in (from their session cookie presumably) + /* Display the users last 20 posts in decending order. */ + $user = Session::read('username'); + + //Since there can only be one of each username, getting the first occurence of $user should be fine + $query = User::find('first', array('conditions' => array('username' => $user))); + $feed = $query->posts; + + + return compact($feed); //Return the feed array to the + } + + /** + * New needs to do a few things + * 1) Validation, + * Ensure that the post is unique, + * Flood protection + * Spam Protection at some point + * 2) Storage + * The post needs to be stored in the users feed as well as users who are friends with them + * + */ + public function new() + { + + } + + /** + * Hide needs to put a "HIDES" edge on the graph + * By getting the users document from the database, querying its id + *then doing something like $thisUser->hides($username) + */ + public function hide($username) + { + + } + + + /** + *Does the same sort of validation as new, but deletes a post obviously :P + */ + public function delete($id) + { + $user = Auth::check('default'); + $post = Post::find($id); + + if ($post->username == $user['username']) { + $post->delete(); + } + + return $this->redirect('Feed::Index'); + + } +} + +?> \ No newline at end of file -- cgit v1.2.3