diff options
-rw-r--r-- | controllers/AnimelistController.php | 28 |
1 files changed, 6 insertions, 22 deletions
diff --git a/controllers/AnimelistController.php b/controllers/AnimelistController.php index 47e5de2..736921a 100644 --- a/controllers/AnimelistController.php +++ b/controllers/AnimelistController.php @@ -16,6 +16,10 @@ class AnimeListController extends \lithium\action\Controller { public function view($username, $sort = "all") { $user = User::find('first', array('conditions' => compact('username'))); + if ($user == NULL) + { + return; + } $watching = array(); $paused = array(); @@ -23,9 +27,6 @@ class AnimeListController extends \lithium\action\Controller { $planning = array(); $finished = array(); - //The anime list comes back as a DocumentArray, so we can - //parse through them with a foreach - //For each entry, foreach($user->animelist as $entry) { //Sort it based on status @@ -63,46 +64,30 @@ class AnimeListController extends \lithium\action\Controller { } } - //Ensure the correct user here public function add($id = null) { - //If id is null, - if ('id' == null) { - //Redirect them to the search page + if (!is_numeric($id)) { return $this->redirect('Animelist::addsearch'); } - //Find the requested anime $anime = Anime::find('first', array('conditions' => array('special_id' => $id))); $entry = null; - - //If data was submitted if ($this->request->data) { - //Create an entry with the data $entry = Entry::create($this->request->data); - - - //Get the current user $user = Auth::check('default'); $username = $user['username']; - - //Break the tags into an array if (isset($this->request->data['tags'])) { $entry->my_tags = explode(',', $this->request->data['tags']); unset($this->request->data['tags']); } - if($entry->add($username)) { - - //Redirect the user to their anime list return $this->redirect("/animelist/view/$username"); } } - return compact('entry', 'anime'); } @@ -118,5 +103,4 @@ class AnimeListController extends \lithium\action\Controller { } } - -}
\ No newline at end of file +} |