diff options
-rw-r--r-- | controllers/UsersController.php | 42 | ||||
-rw-r--r-- | views/anime_list/addsearch.html.php | 4 |
2 files changed, 7 insertions, 39 deletions
diff --git a/controllers/UsersController.php b/controllers/UsersController.php index 23cad20..d272d4f 100644 --- a/controllers/UsersController.php +++ b/controllers/UsersController.php @@ -13,7 +13,6 @@ use li3_flash_message\extensions\storage\FlashMessage; use lithium\template\helper\Html; class UsersController extends \lithium\action\Controller { - public $secret = "marshmallows"; //I don't know why either? //Make login a public action. public $publicActions = array('login', 'logout', 'signup', 'confirm'); @@ -113,12 +112,11 @@ class UsersController extends \lithium\action\Controller { { $status = true; - return array('sucseeded' => true, 'message' => 'You are now following $username'); + return array('succeeded' => true, 'message' => 'You are now following $username'); } } } } - /** * Calls the user to addFriend method, then returns the status. * @param username The name of the user to add as a friend @@ -183,42 +181,12 @@ class UsersController extends \lithium\action\Controller { { //Get the currently logged in user $user = Auth::check('default'); - - //If there is a user logged in (There should be since feed isn't a public function) - if ($user) - { - //Get that user from the database - $user = User::find('first', array('conditions' => array('username' => $user['username']))); - - //Set the feed variable scope (since we are going to use it outside the loop) - $feed; + $user = User::find($user['id']); - if (isset($user->feed)) { - //For each post ID in $users feed, - foreach ($user->feed as $post) - { - //Find the post by it's ID - $post = Post::find($post); - - //If a post was found, - if (!empty($post)) - { - //Add it to the feed - $feed[] = $post; - } - //Else we should remove the the ID from the users feed. - } - - /* new posts are appended to the end of the feed array, therefore new posts naturally end up at the bottom of the feed - * therefore, we reverse the order of the array so that new posts end up at the top of the feed. - * This is probably faster than doing sorting by date at the database level, though it for some reason - * posts don't get inserted in the right order it could cause them to come out wrong in the view */ - $feed = array_reverse($feed); - //This renders a custom layout we use for the feed, then passes user and feed to the view for the variables. - } - return compact('user', 'feed'); - } + + + return compact('user', 'feed'); } /* diff --git a/views/anime_list/addsearch.html.php b/views/anime_list/addsearch.html.php index eb5cbe1..2e3c935 100644 --- a/views/anime_list/addsearch.html.php +++ b/views/anime_list/addsearch.html.php @@ -3,10 +3,10 @@ <?= $this->form->text('Search', array('value' => 'Search for...')); ?> <?= $this->form->submit('Go', array('class' => 'button')); ?> <?= $this->form->end(); ?> -<?php if (isset($content)): ?> +<?php if (isset($anime)): ?> <table class="table"> <tr><th>Entry #</th><th>Name</th><th>Type</th><th>Episodes</th><th>Score</th><th>Add</th></tr> - <?php $i = 1; foreach($content as $result): ?> + <?php $i = 1; foreach($anime as $result): ?> <tr> <td># <?= $i ?></td> <td><?= $result->title ?></td> |